Created
July 22, 2014 14:03
-
-
Save akshay-bhardwaj/0fbb2063c5a0e04c1843 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webdriver = require('wd') | |
, assert = require('assert') | |
, colors = require('colors'); | |
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 | |
}); | |
var browser = webdriver.remote( | |
"hub.browserstack.com" | |
, 80 | |
); | |
browser.on('status', function(info){ | |
console.log(info.cyan); | |
}); | |
browser.on('command', function(meth, path, data){ | |
console.log(' < ' + meth.yellow, path.green, data || ''); | |
}); | |
var desired = { | |
browserName: 'chrome' | |
, version: '22.0' | |
, platform: 'WINDOWS' | |
, name: "This is an example test" | |
, 'browserstack.user': '<username>' | |
, 'browserstack.key': '<key>' | |
}; | |
browser.init(desired, function() { | |
browser.get("http://www.google.com", function() { | |
browser.title(function(err, title) { | |
browser.elementByName('q', function(err, el) { | |
el.sendKeys("BrowserStack", function() { | |
browser.elementByName("btnG", function(err,el) { | |
el.click(function() { | |
browser.quit(); | |
}) | |
}) | |
}) | |
}) | |
}) | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment