rubygoogle-chromewatir

How to save Chrome's settings when using Watir?


Chrome is interrupting the flow and asking about whether I (the user) want to allow desktop notifications to be sent by the current site. I've tried changing this in the Advanced Settings page of Chrome, but each time Watir instantiates a new browser instance all the settings are back to the default.

Instead of dealing with code to handle this kind of thing, I'd much prefer to spawn an instance with settings I've specified but I can't find how to do this.

Watir Webdriver 0.9.1


Solution

  • The above works but I have found that sometimes profile settings are not always picked up. An alternative is to use chrome's command line switches.

    You can add them like so:

    b = Watir::Browser.new :chrome, :switches => %w[--disable-notifications]
    

    A full list of all command line switches can be found here. http://peter.sh/experiments/chromium-command-line-switches/

    To note: Not all of these switches still work with the current version of chrome.