Skip to content

selenium-webdriver/testing example for node does not work. #3377

Description

@levino

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions