LoginSignup
3
2

More than 5 years have passed since last update.

Selenium grid で chrome node に option を設定する

Last updated at Posted at 2018-07-25

結論

goog:chromeOptions に設定する

  caps = Selenium::WebDriver::Remote::Capabilities.chrome
  caps['goog:chromeOptions'] = { args: ['--incognito'] }

  Capybara::Selenium::Driver.new(app,
                                 browser: :remote,
                                 desired_capabilities: caps,
                                 url: 'http://localhost:4444/wd/hub')

Selenium Grid での問題

ここの docker を使って、selenium-hub, node の構成で selenium を実行する時の話。ここにあるように、chromeOptions に 起動オプションを設定しても、node に反映されない

  caps = Selenium::WebDriver::Remote::Capabilities.chrome
  caps['chromeOptions'] = { args: ['--incognito'] }

  Capybara::Selenium::Driver.new(app,
                                 browser: :remote,
                                 desired_capabilities: caps,
                                 url: 'http://localhost:4444/wd/hub')

以下の issue にあるように chromeOptions ではなくて goog:chromeOptions に設定すると有効になる。
https://github.com/elgalu/docker-selenium/issues/201#issuecomment-355138247

chromedriver の仕様変更の影響らしい
https://github.com/SeleniumHQ/docker-selenium/issues/674

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2