本文整理汇总了TypeScript中selenium-webdriver.promise类的典型用法代码示例。如果您正苦于以下问题:TypeScript promise类的具体用法?TypeScript promise怎么用?TypeScript promise使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了promise类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should call execute on fulfilled executors', (done) => {
let deferred = webdriver.promise.defer();
var deferredExecutor = new DeferredExecutor(deferred.promise);
deferred.fulfill(makeExecutor(done));
deferredExecutor.execute('command');
});
开发者ID:sjelin,项目名称:webdriver-js-extender,代码行数:7,代码来源:deferredExecutor_spec.ts
示例2: buildPath
this.schedule = (command: Command, description: string) => {
command.setParameter('sessionId', sessionId);
var params = command.getParameters();
return webdriver.promise.fulfilled(execCallback(
buildPath(this.paths_[command.getName()], params),
description, params));
};
开发者ID:sjelin,项目名称:webdriver-js-extender,代码行数:7,代码来源:mockdriver.ts
示例3: buildPath
execute: (command: webdriver.Command) => {
command.setParameter('sessionId', sessionId);
let params = command.getParameters();
return webdriver.promise.fulfilled(execCallback(
buildPath(paths[command.getName()], params),
methods[command.getName()], params));
},
开发者ID:angular,项目名称:webdriver-js-extender,代码行数:7,代码来源:mockdriver.ts
示例4: navigateToCurrentUrlWithNewBrowser
navigateToCurrentUrlWithNewBrowser(): webDriverPromise.Promise<EsfHome> {
var esfHome2 = new EsfHome(browser.forkNewDriverInstance());
var deferredResult = webDriverPromise.defer<EsfHome>();
this.getCurrentUrl().then((url) => {
esfHome2.navigateToUrl(url);
deferredResult.fulfill(esfHome2);
});
return deferredResult.promise;
}
开发者ID:domasmas,项目名称:esf,代码行数:10,代码来源:esf.WebsiteHome.pageObject.ts
示例5: quitDrivers
/**
* Quits an array of drivers and returns a native promise instead of a webdriver one
*
* @param drivers {webdriver.WebDriver[]} The webdriver instances
*/
static quitDrivers(provider: DriverProvider, drivers: WebDriver[]): Promise<void> {
let deferredResolve: (x?: any) => void;
let deferredReject: (x?: any) => void;
let deferred = new Promise<void>((resolve, reject) => {
deferredResolve = resolve;
deferredReject = reject;
});
wdpromise.all(drivers.map((driver: WebDriver) => provider.quitDriver(driver)))
.then(() => deferredResolve(), () => deferredReject());
return deferred;
}
开发者ID:NickTomlin,项目名称:protractor,代码行数:16,代码来源:driverProvider.ts
示例6: _getRatesForIndicative
private _getRatesForIndicative(skipOptionClick) {
var promises = [];
if (!skipOptionClick) {
promises.push(this._waitAndClick(By.xpath(`//*[@id='nonINRradio']/*[@id='moneyType']`)));
}
promises.push(driver.wait(until.elementLocated(By.xpath(`//*[@id="txnAmountDiv1"]/input`)), 5 * 1000)
.then(el => el.sendKeys('1000')));
promises.push(this._waitAndClick(By.xpath(`//a[@onclick='calculate();']`)));
return promise.all(promises)
.then(_ => this._extractRates(true))
.then(resultPromise => promise.all(resultPromise));
}
开发者ID:vmanikandan001,项目名称:xcngr,代码行数:13,代码来源:m2indiaProvider.ts
示例7: _setSearchParameters
private _setSearchParameters(currency, transferMode, deliveryMode) {
driver.get(URL);
var locators = [
By.xpath(`//*[@id='currencyId']/option[text()='${currency}'] `),
By.xpath(`//*[@id='product']/option[text()='${transferMode}'] `),
By.xpath(`//*[@id='deliveryMode']/option[text()='${deliveryMode}']`)];
var promises = locators.map(locator => this._waitAndClick(locator));
return promise.all(promises)
.then(_ => console.log(`Search parameters currency: ${currency}, transferMode:${transferMode}, deliveryMode: ${deliveryMode} set successfully`))
.thenCatch(err => console.log(`Error while setting search parameters currency:
${currency}, transferMode:${transferMode}, deliveryMode: ${deliveryMode}. Error: ${err.message}`));
}
开发者ID:vmanikandan001,项目名称:xcngr,代码行数:14,代码来源:m2indiaProvider.ts
示例8: quitDrivers
/**
* Quits an array of drivers and returns a q promise instead of a webdriver one
*
* @param drivers {webdriver.WebDriver[]} The webdriver instances
*/
static quitDrivers(provider: DriverProvider, drivers: WebDriver[]): q.Promise<void> {
let deferred = q.defer<void>();
wdpromise
.all(drivers.map((driver: WebDriver) => {
return provider.quitDriver(driver);
}))
.then(
() => {
deferred.resolve();
},
() => {
deferred.resolve();
});
return deferred.promise;
}
开发者ID:DylanLacey,项目名称:protractor,代码行数:20,代码来源:driverProvider.ts
示例9: getElementArrayAsList
/**
* The given array is of promises. Resolve those and return as an array of strings of the element.getText()
* @param array
* @return
*/
public static getElementArrayAsList(array: ElementArrayFinder): promise.Promise<string[]> {
let deferred = promise.defer();
let out: string[] = new Array<string>();
array.then((elements) => {
elements.forEach((element: ElementFinder) => {
element.getText().then(
(text: string) => {
if (text.length > 0) {
out.push(text);
}
}
);
});
});
deferred.fulfill(out);
return deferred.promise;
}
开发者ID:GeoscienceAustralia,项目名称:gnss-site-manager,代码行数:22,代码来源:test.utils.ts
注:本文中的selenium-webdriver.promise类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论