本文整理匯總了TypeScript中protractor.ProtractorExpectedConditions類的典型用法代碼示例。如果您正苦於以下問題:TypeScript ProtractorExpectedConditions類的具體用法?TypeScript ProtractorExpectedConditions怎麽用?TypeScript ProtractorExpectedConditions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ProtractorExpectedConditions類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
/// <reference path="../../built/index.d.ts" />
import {Browser, ElementArrayFinder, ElementFinder, ElementHelper, ProtractorExpectedConditions, ProtractorBy} from 'protractor';
let browser: Browser;
let by: ProtractorBy;
let By: ProtractorBy;
let element: ElementHelper;
let $: (search: string) => ElementFinder;
let $$: (search: string) => ElementArrayFinder;
let ExpectedConditions: ProtractorExpectedConditions;
element.all(by.css('')).clone();
element.all(by.css('')).then(() => {}, () => {}); // this is not appearing on the website
element.all(by.css('')).filter(() => {});
element.all(by.css('')).get(0);
element.all(by.css('')).first();
element.all(by.css('')).last();
element.all(by.css('')).count();
element.all(by.css('')).locator();
element.all(by.css('')).each((element: any, index: number) => {});
element.all(by.css('')).map(() => {});
element.all(by.css('')).reduce(() => {}, '');
element.all(by.css('')).evaluate('expression');
element.all(by.css('')).allowAnimations(false);
element.all(by.css('')).$$('');
element.all(by.css('')).getDriver();
element.all(by.css('')).getId();
element.all(by.css('')).getRawId();
element.all(by.css('')).serialize();
element.all(by.css('')).findElement(by.css(''));
element.all(by.css('')).click();
element.all(by.css('')).getTagName();
element.all(by.css('')).getCssValue('cssStyleProperty');
示例2:
/// <reference path="../../built/ambient.d.ts" />
import {ProtractorExpectedConditions} from 'protractor';
let ExpectedConditions: ProtractorExpectedConditions;
ExpectedConditions.not(0);
ExpectedConditions.not('1');
ExpectedConditions.not(true);
ExpectedConditions.and(0);
ExpectedConditions.and('1');
ExpectedConditions.and(true);
ExpectedConditions.or(0, () => {});
ExpectedConditions.or('1', () => {});
ExpectedConditions.or(true, () => {});
ExpectedConditions.or(() => {}, 0);
ExpectedConditions.or(() => {}, '1');
ExpectedConditions.or(() => {}, true);
ExpectedConditions.or(0, '1');
ExpectedConditions.alertIsPresent(0);
ExpectedConditions.alertIsPresent('1');
ExpectedConditions.alertIsPresent(true);
ExpectedConditions.alertIsPresent(() => {});
ExpectedConditions.elementToBeClickable(0);
ExpectedConditions.elementToBeClickable('1');
ExpectedConditions.elementToBeClickable();
ExpectedConditions.elementToBeClickable(true);
ExpectedConditions.elementToBeClickable(() => {});
示例3: sendKeysOnElement
async sendKeysOnElement(xpath:string, data:string, timeOut=this.timeOut) {
console.log("Sending key to element " + xpath)
var ele:ElementFinder = await this.curBrowser.element(by.xpath(xpath));
await this.curBrowser.wait(this.until.presenceOf(ele), timeOut, 'Element ' + xpath +' takes too long to appear in the DOM');
await this.curBrowser.wait(this.until.visibilityOf(ele), timeOut, 'Element '+ xpath +' is not visible');
await ele.sendKeys(data)
}
示例4: clickOnElement
async clickOnElement(xpath:string, timeout=this.timeOut){
console.log("Clicking on element " + xpath)
var ele= await this.curBrowser.element(by.xpath(xpath))
await this.curBrowser.wait(this.until.presenceOf(ele),timeout, 'Element ' + xpath +' takes too long to appear in the DOM')
await this.curBrowser.wait(this.until.elementToBeClickable(ele), this.timeOut, 'Element ' + xpath +' is NOT clickable')
await ele.click()
}
示例5: getElementAttribute
async getElementAttribute(xpath:string, attribute:string):Promise<string>{
var ele:ElementFinder = await this.curBrowser.element(by.xpath(xpath))
var attributeValue:string =""
await this.curBrowser.wait(this.until.presenceOf(ele), this.timeOut, 'Element ' + xpath + ' takes too long to appear in the DOM' )
await ele.getAttribute(attribute).then(function(value){
console.log("Attribute value: " + value)
attributeValue = value
})
return attributeValue
}
示例6: waitForElementDisplay
async waitForElementDisplay(xpath:string) {
var ele = await this.curBrowser.element(by.xpath(xpath));
await this.curBrowser.wait(this.until.presenceOf(ele), this.timeOut, 'Element ' + xpath +' takes too long to appear in the DOM');
await this.curBrowser.wait(this.until.visibilityOf(ele), this.timeOut, 'Element '+ xpath +' is not visible on screen');
}