Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
levino opened this issue Jan 18, 2017 · 0 comments
Closed

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

levino opened this issue Jan 18, 2017 · 0 comments

Comments

@levino
Copy link

levino commented Jan 18, 2017

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

@jleyba jleyba closed this as completed in 21d22d6 Jan 23, 2017
@lock lock bot locked and limited conversation to collaborators Aug 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant