Disable All Notifications in Chrome

214 views
Skip to first unread message

Abhinav Sharma

unread,
May 11, 2017, 12:53:18 PM5/11/17
to NightwatchJs
Hi,
I started using Nightwatch & find it absolutely amazing.
One of my recent projects require me to disable web notifications(Push Notifications) or any kind of alerts in chrome.

I am trying to achieve this by passing 
"--disable-notifications"
in the args key of chromeOptions in my nightwatch.json file, but it doesn't seem to be working.

I googled and saw that I must set a preference in "experimentalOption" in chromeOptions having
"profile.default_content_setting_values.notifications", 2


What is the way to do this in Nightwatch using with chromedriver ?

I've attached my nightwatch.json configuration file.



nightwatch.json

Ellen Wong

unread,
May 16, 2017, 7:08:49 PM5/16/17
to NightwatchJs
"profile.default_content_setting_values.notifications":2

Looks like you're setting this correctly in your nightwatch.json. Is it still not working?

Andrey Morozov

unread,
May 20, 2017, 1:49:52 PM5/20/17
to NightwatchJs
This is what works for me, try adding the following in your chrome spec like so: 



chromeOptions
: {
        prefs
: {
            credentials_enable_service
: false,
            profile
: {
                password_manager_enabled
: false
           
}
       
},
   
}
Reply all
Reply to author
Forward
0 new messages