LoginSignup
1
1

More than 3 years have passed since last update.

user-data-dirを設定しているSelenium WebDriverでChromeのheadlessモードだと落ちる

Posted at
profile_dir =  File.expand_path("profile",__dir__).encode("UTF-8")

U_d_Dir = "--user-data-dir=" + profile_dir
options = Selenium::WebDriver::Chrome::Options.new(args: ["--headless" ,'--no-sandbox', U_d_Dir])
driver = Selenium::WebDriver.for :chrome, options: options

参考
【未解決】user-data-dirを設定しているSelenium WebDriverでChromeのheadlessモードが利用できない
https://teratail.com/questions/142395
chromedriver で headless と user-data-dir のオプションを同時に指定するとエラーが発生する
https://ja.stackoverflow.com/questions/51441/chromedriver-%E3%81%A7-headless-%E3%81%A8-user-data-dir-%E3%81%AE%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3%E3%82%92%E5%90%8C%E6%99%82%E3%81%AB%E6%8C%87%E5%AE%9A%E3%81%99%E3%82%8B%E3%81%A8%E3%82%A8%E3%83%A9%E3%83%BC%E3%81%8C%E7%99%BA%E7%94%9F%E3%81%99%E3%82%8B

1
1
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
1
1