Disabling popups using C# in Selenium -


i apologize in advance if following question seems basic, new selenium , need help.

so trying is, trying open window popup chrome browser blocking own.

i used following code:

chromeoptions options = new chromeoptions(); options.adduserprofilepreference("disable-popup-blocking", "true"); iwebdriver driver = new remotewebdriver(new uri("http://path/to/selenium/server"), options.tocapabilities()); 

but throwing me exception saying:

unexpected error. system.net.webexception: remote name not resolved: 'path'.

i have tried this, didn't though gave me rough idea.

can please help?

(reference: unblocking popup using selenium using c#)

try below :-

chromeoptions options = new chromeoptions(); chromeoptions.addargument("--disable-popup-blocking");  desiredcapabilities capabilities = desiredcapabilities.chrome(); capabilities.setcapability(chromeoptions.capability, options);  iwebdriver driver = new remotewebdriver(new uri("http://localhost:4444/wd/hub"), capabilities); 

edited :- if want use chromedriver instead of remotewebdriver try below :

chromeoptions options = new chromeoptions(); chromeoptions.addargument("--disable-popup-blocking"); iwebdriver driver = new chromedriver(@"c:\path\chromedriver", options); 

hope works...:)


Comments