Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var webdriver = require('selenium-webdriver');
var keyword = "Magic";
var driver = new webdriver.Builder().
usingServer('http://localhost:4444/wd/hub/').
withCapabilities(webdriver.Capabilities.chrome()).
build();
driver.get('http://www.google.com');
driver.findElement(webdriver.By.name('q')).sendKeys(keyword);
driver.findElement(webdriver.By.name('btnG')).click();
driver.wait(function() {
return driver.getTitle().then(function(title) {
return driver.getPageSource().then(function(html) {
console.log(html);
return true;
});
});
}, 1000);
driver.quit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.