Langmeister Posted July 17, 2020 Share Posted July 17, 2020 (edited) I am once again asking for your experienced assistance. If I open a website that uses notifications I am asked to allow or block them for that website after a few seconds. This notification pops up every time the page gets navigated to, even tho you have clicked on allow for several times. I am explicitly not searching for smth to get rid of "Chrome is being controlled by automated test sw". Instead I am searching for a line of script to disable all notifications by default: like here chrome://settings/content/notifications. This is code should give you an example of what notifications I am talking about: #include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities, $sSession, $sID _WD_Option("Driver", "C:\Program Files (x86)\AutoIt3\chromedriver.exe") _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}' _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://webradio.planetradio.de/") _WD_LoadWait($sSession) Edited July 17, 2020 by Langmeister Issue solved Link to comment Share on other sites More sharing options...
Danp2 Posted July 17, 2020 Share Posted July 17, 2020 A quick search of both Google and these fora yields the answer -- Pass "disable-notifications" as an argument in your DesiredCapabilities string Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Langmeister Posted July 17, 2020 Author Share Posted July 17, 2020 @Danp2 It was my first thought that smth has to be adjusted in the DesiredCapabilities string but if you mean adding it like this, it doesn't work. $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"disable-notifications": {"w3c": true }}}}}' Returning this: _WD_CreateSession: {"value":{"error":"invalid argument","message":"invalid argument: cannot parse capability: goog:chromeOptions\nfrom invalid argument: unrecognized chrome option: disable-notifications","stacktrace":"Backtrace: (...) _WD_CreateSession ==> Webdriver Exception: invalid argument: cannot parse capability: goog:chromeOptions from invalid argument: unrecognized chrome option: disable-notifications Link to comment Share on other sites More sharing options...
Danp2 Posted July 17, 2020 Share Posted July 17, 2020 @Langmeister Please put in some effort to identify the correct syntax. As mentioned earlier, you can find it with Google or searching in the forums. Langmeister 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Langmeister Posted July 17, 2020 Author Share Posted July 17, 2020 (edited) @Danp2 So to speak the mistake sat in front of the pc. Putting it in the right format did all the magic and works fine now with this: $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-notifications"]}}}}' Thanks for your answers in the past! Edited July 17, 2020 by Langmeister Danp2 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now