本文整理汇总了TypeScript中protractor.ElementFinder.isDisplayed方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ElementFinder.isDisplayed方法的具体用法?TypeScript ElementFinder.isDisplayed怎么用?TypeScript ElementFinder.isDisplayed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protractor.ElementFinder
的用法示例。
在下文中一共展示了ElementFinder.isDisplayed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should toggle content on show', () => {
expect(rxToggleContent.isDisplayed()).to.eventually.be.false;
rxToggle.click();
expect(rxToggleContent.isDisplayed()).to.eventually.be.true;
rxToggle.click();
expect(rxToggleContent.isDisplayed()).to.eventually.be.false;
});
示例2: it
it('should close again', async () => {
await element(by.buttonText('Open sidenav')).click();
await browser.sleep(50);
await element(by.buttonText('Open sidenav')).click();
expect(await sidenav.isDisplayed()).toBeFalsy();
});
示例3: it
it('should close again', () => {
element(by.buttonText('Open sidenav')).click();
browser.sleep(50);
element(by.buttonText('Open sidenav')).click();
expect(sidenav.isDisplayed()).toBeFalsy();
});
示例4: scrollAndClickIfDisplayed
/**
* The tables that rxPaginate operates on tend to be squirly, and elements change position
* frequently, especially when the number of items in the table changes due to page size. This protected
* utility function will help ensure elements are clickable before clicking them.
*/
protected scrollAndClickIfDisplayed(elem: ElementFinder): Promise<void> {
return elem.isDisplayed().then(displayed => {
if (displayed) {
rxMisc.scrollToElement(elem, {positionOnScreen: 'middle'});
return elem.click();
}
});
}
示例5: isVisibleInViewport
/** Checks if the given element is visible in the given viewport. */
async function isVisibleInViewport(el: ElementFinder, viewport: ElementFinder): Promise<boolean> {
if (!await el.isPresent() || !await el.isDisplayed() || !await viewport.isPresent() ||
!await viewport.isDisplayed()) {
return false;
}
const viewportRect = getRect(await viewport.getLocation(), await viewport.getSize());
const elRect = getRect(await el.getLocation(), await el.getSize());
return elRect.left < viewportRect.right && elRect.right > viewportRect.left &&
elRect.top < viewportRect.bottom && elRect.bottom > viewportRect.top;
}