LoginSignup
9
8

More than 5 years have passed since last update.

webdriver起動時に付けたいオプション

Posted at

とりあえずchromeだけ。

想定するケースは二つ。

1.開発中の環境のため、SSL証明書がオレオレなので警告画面が出てテストが止まるのをなんとかしたい。
2.ユーザのaccept-languageをブラウザデフォルトから一時的に変えたい

これらを合わせて解決するのが次の設定。GebConfig.groovyに書いたらいいと思う。

def capabilities = DesiredCapabilities.chrome()
capabilities.setCapability("chrome.switches", Arrays.asList("--ignore-certificate-errors", "--lang=en_US"))
return new ChromeDriver(capabilities)

--ignore-certificate-errorsは証明書エラーを無視、--lang=en_USは言語コードの設定。chromeの起動オプション知ってれば、たぶんcapabilitiesで設定できるのでは。

9
8
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
9
8