Skip to content

Instantly share code, notes, and snippets.

@akshay-bhardwaj
Last active August 29, 2015 14:02
Show Gist options
  • Save akshay-bhardwaj/57817b7e731f5f468e38 to your computer and use it in GitHub Desktop.
Save akshay-bhardwaj/57817b7e731f5f468e38 to your computer and use it in GitHub Desktop.
var webdriver = require('selenium-webdriver');
var http = require('http');
var globalTunnel = require('global-tunnel');
globalTunnel.initialize({
host: 'localhost', // set proxy ip or hostname
port: 9091, // set proxy port
sockets: 50 // optional pool size for each http and https
});
// Input capabilities
var capabilities = {
'browserName' : 'firefox',
'browserstack.user' : '<username>',
'browserstack.key' : '<userkey>'
}
var driver = new webdriver.Builder().
usingServer('http://hub.browserstack.com/wd/hub').
withCapabilities(capabilities).
build();
driver.get('http://www.google.com/ncr');
driver.findElement(webdriver.By.name('q')).sendKeys('BrowserStack');
driver.findElement(webdriver.By.name('btnG')).click();
driver.getTitle().then(function(title) {
console.log(title);
});
driver.quit();
console.log("Going to quit the script: " + code.toString());
globalTunnel.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment