Disable Chrome notifications (Selenium)

后端 未结 5 1512
暗喜
暗喜 2020-12-06 17:46

I just want to disable Chrome notifications in the Chrome opened by a Selenium Java application. (using java code)

Notifications like this one:

The

5条回答
  •  伪装坚强ぢ
    2020-12-06 18:45

    Someone needs this for Capybara or Watir, you can pass the --disable-notifications as an argument like "--start-fullscreen", "--disable-infobars". The following workes:

    Capybara.register_driver :chrome do |app|
      args = ["--disable-notifications"]
      Capybara::Selenium::Driver.new(app, {:browser => :chrome, :args => args})
    end
    

提交回复
热议问题