How to use the promise function from selenium-webdriver
Find comprehensive JavaScript selenium-webdriver.promise code examples handpicked from public code repositorys.
GitHub: paypal/nemo-core
0 1 2 3 4 5 6 7 8 9
const webdriver = require('selenium-webdriver'); const async = require('async'); function driversetup(nemo) { var d = webdriver.promise.defer(); async.waterfall([function setup(cb) { nemo.driver = new webdriver .Builder() .forBrowser('phantomjs')
91
259
22
GitHub: dowjones/fiveby
64 65 66 67 68 69 70 71 72 73
if (!webdriver.Capabilities[elem]) { return console.warn('No such browser: %s', elem); } var lastPromise = global.testPromise || webdriver.promise.fulfilled(); var testComplete = webdriver.promise.defer(); global.testPromise = testComplete.promise; //create a driver per test file lastPromise.then(function () {
8
134
14
+ 23 other calls in file
31 32 33 34 35 36 37 38 39 40
FormAuthenticator.prototype.get = function(url){ var that = this; if (!this.user || !this.pass) { return webdriver.promise.rejected( new Error('Form auth requested but user or pass is not specified')); } // webdriver statements are synchronized by webdriver flow so no need to join the promises
56
120
21
60 61 62 63 64 65 66 67 68 69
const conds = spec.map(this.createCondition, this); const descriptions = conds.map(c => c.description()); const desc = ['for all of these:'].concat(descriptions).join('\n* '); return new Condition(desc, driver => webdriver.promise.all(conds.map(c => c.fn(driver))) .then(values => values.every(Boolean)) ); } },
0
2
2
+ 3 other calls in file
63 64 65 66 67 68 69 70 71 72
}; Query.prototype.filter = function (elements) { const filters = this.filters; if (!filters) return elements; return webdriver.promise.filter(elements, el => webdriver.promise.map(filters, f => f.test(el) ) .then(res => res.every(Boolean))
0
2
2
+ 3 other calls in file
GitHub: vrtdev/protractor
195 196 197 198 199 200 201 202 203 204
} minijn.addSpecs(resolvedSpecs); // TODO: This should not be tied to the webdriver promise loop, it should use // another promise system instead. var runDeferred = webdriver.promise.defer(); if (config.chromeOnly) { if (!fs.existsSync(config.chromeDriver)) { if (fs.existsSync(config.chromeDriver + '.exe')) {
0
1
16
+ 3 other calls in file
GitHub: shootdaj/MIDIatorModules
23 24 25 26 27 28 29 30 31 32
this.WebDriver = webdriver.WebDriver; this.WebElement = webdriver.WebElement; this.WebElementPromise = webdriver.WebElementPromise; this.error = webdriver.error; this.logging = webdriver.logging; this.promise = webdriver.promise; this.until = webdriver.until; this.Command = require('selenium-webdriver/lib/command').Command; this.CommandName = require('selenium-webdriver/lib/command').Name; this.utils = {
1
0
2
GitHub: blend/protractor
47 48 49 50 51 52 53 54 55 56
WebDriver = webdriver.WebDriver; WebElement = webdriver.WebElement; WebElementPromise = webdriver.WebElementPromise; error = webdriver.error; logging = webdriver.logging; promise = webdriver.promise; until = webdriver.until; Command = require('selenium-webdriver/lib/command').Command; CommandName = require('selenium-webdriver/lib/command').Name; utils = {
0
0
35
+ 5 other calls in file
GitHub: amilajack/protractor
34 35 36 37 38 39 40 41 42 43
actions: () => webdriver.ActionSequence = webdriver.WebDriver.actions; wait: (condition: webdriver.promise.Promise|webdriver.util.Condition|Function, opt_timeout?: number, opt_message?: string) => webdriver.promise.Promise = webdriver.WebDriver.wait; sleep: (ms: number) => webdriver.promise.Promise = webdriver.WebDriver.sleep; getCurrentUrl: () => webdriver.promise.Promise = webdriver.WebDriver.getCurrentUrl; getTitle: () => webdriver.promise.Promise = webdriver.WebDriver.getTitle;
0
0
2
+ 13 other calls in file
selenium-webdriver.Builder is the most popular function in selenium-webdriver (1701 examples)