Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simpleprogrammer-shared/d77039b4691c56aaa49c9e2362aa61b7 to your computer and use it in GitHub Desktop.
Save simpleprogrammer-shared/d77039b4691c56aaa49c9e2362aa61b7 to your computer and use it in GitHub Desktop.
Selenium With Node.js and Mocha: Automated Testing With JavaScript 2
var assert = require('assert'),
test = require('selenium-webdriver/testing'),
webdriver = require('selenium-webdriver');
test.describe('Google Search', function() {
test.it('should work', function() {
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();
driver.get('http://www.google.com');
var searchBox = driver.findElement(webdriver.By.name('q'));
searchBox.sendKeys('simple programmer');
searchBox.getAttribute('value').then(function(value) {
assert.equal(value, 'simple programmer');
});
driver.quit();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment