Search code examples
rubygoogle-chromeautomationselenium-chromedriverwatir

Chromedriver switches --disable-popup-blocking Doesn't Work Using Ruby in Headless Mode


I start my chromedriver like this in Ruby

driver = Watir::Browser.new :chrome, :switches => %w[--ignore-certificate-errors --disable-popup-blocking --disable-translate --disable-notifications --start-maximized]

But, when I start using headless mode like below, it returns nothing.

driver = Watir::Browser.new :chrome, :switches => %W[--ignore-certificate-errors --disable-popup-blocking --disable-translate --disable-notifications --disable-gpu --headless]

I need the switch --disable-popup-blocking in order to prevent the "Allow Location" popup on the website I am trying to access. It works if the chrome doesn't start in headless. But it doesn't work in headless mode. Is there any way to make it works?

Thanks in advance.


Solution

  • Chrome Preferences are not currently supported in Headless Mode. See Comment 7 in this Chromium Bug