Skip to content

Instantly share code, notes, and snippets.

@SergeyAvd
Created February 6, 2017 19:49
Show Gist options
  • Save SergeyAvd/ae17c44e8f98db6fa14f8c80c1eb2b72 to your computer and use it in GitHub Desktop.
Save SergeyAvd/ae17c44e8f98db6fa14f8c80c1eb2b72 to your computer and use it in GitHub Desktop.
Basic example modified to use specified executable
// google_search.js
var chromeDriver = require('chromedriver'), // Auto install ChromeDriver
webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
var path = 'C:\\Users\\savdeev\\Downloads\\chrome-win32\\chrome-win32\\chrome.exe';
var chrome = require("selenium-webdriver/chrome");
var driver = new webdriver.Builder()
.forBrowser('chrome')
.setChromeOptions(new chrome.Options().setChromeBinaryPath(path))
.build();
function start() {
driver.get('http://www.google.com/ncr');
driver.findElement(By.name('q')).sendKeys('webdriver');
driver.findElement(By.name('btnG')).click();
driver.wait(until.titleIs('webdriver - Google Search'), 1000);
}
//process.on('SIGTERM', function shutdown() {
// driver.quit();
//});
start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment