Change example to work with latest versions of selenium-webdriver (#28231)

See https://github.com/SeleniumHQ/selenium/issues/9286
The existing snippet works with selenium-webdriver <= 3.6.0, but any more recent version seems to require using 'goog:chromeOptions' and forBrowser('chrome').
This commit is contained in:
Karel Braeckman 2021-03-18 21:35:04 +01:00 committed by GitHub
parent baadcd48df
commit 8476bed36e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,12 +86,12 @@ const driver = new webdriver.Builder()
// The "9515" is the port opened by chrome driver. // The "9515" is the port opened by chrome driver.
.usingServer('http://localhost:9515') .usingServer('http://localhost:9515')
.withCapabilities({ .withCapabilities({
chromeOptions: { 'goog:chromeOptions': {
// Here is the path to your Electron binary. // Here is the path to your Electron binary.
binary: '/Path-to-Your-App.app/Contents/MacOS/Electron' binary: '/Path-to-Your-App.app/Contents/MacOS/Electron'
} }
}) })
.forBrowser('electron') .forBrowser('chrome') // note: use .forBrowser('electron') for selenium-webdriver <= 3.6.0
.build() .build()
driver.get('http://www.google.com') driver.get('http://www.google.com')