本文整理匯總了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;
}