How to use the Condition function from selenium-webdriver
Find comprehensive JavaScript selenium-webdriver.Condition code examples handpicked from public code repositorys.
78 79 80 81 82 83 84 85 86 87
driver => this.findOne(scope || driver).catch(() => null) ); }; Query.prototype.untilSome = function (scope) { return new webdriver.Condition(`for ${this}`, driver => this.findAll(scope || driver).then( list => (list && list.length ? list : null) ) );
GitHub: alibaba/rax

14 15 16 17 18 19 20 21 22 23
return null; } function waitForCondition(driver) { return async function(text, fn, timeout) { return await driver.wait(new Condition(text, fn), timeout); }; } // driver.findElement(By.xpath("//tbody/tr[1]/td[1]")).getText().then(...) can throw a stale element error:
+ 3 other calls in file
GitHub: ajaxscape/tamarin

11 12 13 14 15 16 17 18 19 20
throw new Error('World must be defined') } until = until || webDriver.until _.extend(until, { foundInPage: (selector) => new webDriver.Condition(`for $("${selector}") to be found in page`, co(function * (selector) { const driver = yield world.getDriver() return yield driver.findElement(By.css(selector)) .then(() => true) .catch(() => false)
+ 7 other calls in file
1 2 3 4 5 6 7 8 9 10
const URL = require('url'); const webdriver = require('selenium-webdriver'); const until = webdriver.until; const Condition = webdriver.Condition; const builtIns = { stale: until.stalenessOf,
86 87 88 89 90 91 92 93 94 95
} async locateElements({parentElement, selector, timeout, retryInterval}) { const createLocateElement = () => { return parentElement && parentElement.webElement ? function(locator) { return new Condition('for at least one element to be located ' + locator, function (driver) { return parentElement.webElement.findElements(locator).then(function (elements) { return elements.length > 0 ? elements : null; }); });
+ 2 other calls in file
selenium-webdriver.Builder is the most popular function in selenium-webdriver (1701 examples)