Created
June 7, 2012 01:12
-
-
Save zacharyc/2885890 to your computer and use it in GitHub Desktop.
Chromedriver with WebDriverJS
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
~ $ /Applications/chromedriver |
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 client = new webdriver.http.CorsClient('http://localhost:9515'); | |
var executor = new webdriver.http.Executor(client); | |
// Launches a new browser, which can be controlled by this script. | |
var driver = webdriver.WebDriver.createSession(executor, { | |
'browserName': 'chrome', | |
'version': '', | |
'platform': 'ANY', | |
'javascriptEnabled': true | |
}); | |
driver.get('http://www.google.com'); | |
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver'); | |
driver.findElement(webdriver.By.name('btnG')).click().then(function() { | |
driver.getTitle().then(function(title) { | |
if (title !== 'webdriver - Google Search') { | |
throw new Error( | |
'Expected "webdriver - Google Search", but was "' + title + '"'); | |
} | |
}); | |
}); | |
driver.quit(); |
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 client = new webdriver.http.CorsClient('http://localhost:4444/wd/hub'); | |
var executor = new webdriver.http.Executor(client); | |
// Launches a new browser, which can be controlled by this script. | |
var driver = webdriver.WebDriver.createSession(executor, { | |
'browserName': 'chrome', | |
'version': '', | |
'platform': 'ANY', | |
'javascriptEnabled': true | |
}); | |
driver.get('http://www.google.com'); | |
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver'); | |
driver.findElement(webdriver.By.name('btnG')).click().then(function() { | |
driver.getTitle().then(function(title) { | |
if (title !== 'webdriver - Google Search') { | |
throw new Error( | |
'Expected "webdriver - Google Search", but was "' + title + '"'); | |
} | |
}); | |
}); | |
driver.quit(); |
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
<!DOCTYPE html> | |
<script src="webdriver.js"></script> | |
<script src="run-driver.js"></script> |
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
~ $ java -jar /<path to selenium>/selenium-server-standalone-<version>.jar -Dwebdriver.chrome.driver=/Applications/chromedriver |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment