Here is the example I tried to run. http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/testing/index.html
It failed with
TypeError: Cannot read property 'execute' of undefined
After I changed the examples code as below it worked fine:
var webdriver = require('selenium-webdriver') // Added line
var By = require('selenium-webdriver').By,
until = require('selenium-webdriver').until,
chrome = require('selenium-webdriver/chrome'),
test = require('selenium-webdriver/testing');
test.describe('Google Search', function() {
var driver;
test.before(function() {
driver = new webdriver.Builder().forBrowser('chrome').build() // Changed line
});
test.after(function() {
driver.quit();
});
test.it('should append query to title', function() {
driver.get('http://www.google.com/ncr');
driver.findElement(By.name('q')).sendKeys('webdriver');
driver.findElement(By.name('btnG')).click();
driver.wait(until.titleIs('webdriver - Google Search'), 1000);
});
});
Maybe the docs are outdated? Took me a while to figure this one out...
Here is the example I tried to run. http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/testing/index.html
It failed with
After I changed the examples code as below it worked fine:
Maybe the docs are outdated? Took me a while to figure this one out...