Skip to content

Instantly share code, notes, and snippets.

@vitalets
Created August 31, 2016 15:29
Show Gist options
  • Select an option

  • Save vitalets/f31221b68c29a8b12c28fb80b2b1dbc9 to your computer and use it in GitHub Desktop.

Select an option

Save vitalets/f31221b68c29a8b12c28fb80b2b1dbc9 to your computer and use it in GitHub Desktop.
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until,
test = require('selenium-webdriver/testing');
test.describe('Google Search (selenium compatible)', function () {
var driver;
test.before(function () {
var capabilities = {
'browserName' : 'chrome',
'os' : 'Windows',
'os_version' : '7',
'browserstack.user': '<user>',
'browserstack.key': '<key>',
'resolution': '1024x768',
};
driver = new webdriver.Builder()
.usingServer('http://hub-cloud.browserstack.com/wd/hub')
.withCapabilities(capabilities)
.build();
});
test.it('should append query to title', function() {
driver.get('http://www.google.com');
driver.findElement(By.name('q')).sendKeys('webdriver');
driver.findElement(By.name('btnG')).click();
driver.wait(until.titleContains('webdriver'), 2000);
});
test.after(function () {
driver.quit();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment