Created
February 6, 2017 21:48
-
-
Save SergeyAvd/3466c9e2330b3a89e7d00a19ccd59f57 to your computer and use it in GitHub Desktop.
Basic example modified to use an already running Chrome browser
This file contains hidden or 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
// google_search.js | |
var chromeDriver = require('chromedriver'), // Auto install ChromeDriver | |
webdriver = require('selenium-webdriver'), | |
By = webdriver.By, | |
until = webdriver.until; | |
var chrome = require("selenium-webdriver/chrome"); | |
var options = new chrome.Options(); | |
options.options_["debuggerAddress"] = "127.0.0.1:6813"; | |
var driver = new webdriver.Builder() | |
.forBrowser('chrome') | |
.setChromeOptions(options) | |
.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); | |
setTimeout(function () {console.log('HI');}, 10000); | |
} | |
process.on('SIGTERM', function shutdown() { | |
driver.quit(); | |
}); | |
start(); |
Hi, Can you please let me know how to achieve this with WebDriverIO? Thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To test launch Chrome before the script like this:
chrome.exe --remote-debugging-port=6813