Created
March 3, 2017 17:27
-
-
Save SergeyAvd/e185291b52b915168ad981ba4dd14e48 to your computer and use it in GitHub Desktop.
Connect to an existing chromedriver on port 9515
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
const {Builder, By, until, Capabilities} = require('selenium-webdriver'); | |
// Make sure `chromedriver --port=9515` was started before | |
var driver = new Builder() | |
.withCapabilities(Capabilities.chrome()) | |
.usingServer('http://localhost:9515') | |
.build(); | |
driver.get('http://www.google.com/ncr') | |
.then(_ => driver.findElement(By.name('q')).sendKeys('webdriver')) | |
.then(_ => driver.findElement(By.name('btnG')).click()) | |
.then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000)) | |
.then(_ => driver.quit()); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment