本文整理匯總了TypeScript中protractor.ElementFinder.isPresent方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ElementFinder.isPresent方法的具體用法?TypeScript ElementFinder.isPresent怎麽用?TypeScript ElementFinder.isPresent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類protractor.ElementFinder
的用法示例。
在下文中一共展示了ElementFinder.isPresent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: 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;
}
示例2: expect
const expectHeroes = (isShown: boolean, ng1HeroCount = 3, statusMessage = 'Ready') => {
// Verify the show/hide button text.
expect(showHideBtn.getText()).toBe(isShown ? 'Hide heroes' : 'Show heroes');
// Verify the `<ng2-heroes>` component.
expect(ng2Heroes.isPresent()).toBe(isShown);
if (isShown) {
expect(ng2HeroesHeader.getText()).toBe('Heroes');
expect(ng2HeroesExtra.getText()).toBe(`Status: ${statusMessage}`);
}
// Verify the `<ng1-hero>` components.
expect(ng1Heroes.count()).toBe(isShown ? ng1HeroCount : 0);
if (isShown) {
ng1Heroes.each(ng1Hero => expect(ng1Hero).toBeAHero());
}
};
示例3: isPresent
isPresent(): promise.Promise<boolean> {
return this.element.isPresent();
}