Click here to Skip to main content
15,069,297 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I wanted to allow "pop-up and redirect" and "Ads" options from chrome://settings/content/ using Selenium Version 3.141 and chrome version is 77 in C#.

The current code Ihave is

var options = new ChromeOptions();
options.SetLoggingPreference("driver", OpenQA.Selenium.LogLevel.All);
options.AddArgument("--disable-extensions"); options.AddUserProfilePreference("profile.default_content_settings.popups", 0);
options.AddUserProfilePreference("download.default_directory", downloadPath); options.AddUserProfilePreference("profile.default_content_setting_values.automatic_downloads", 1);

driver = new ChromeDriver(WebDriverPath, options);

Any help here would be great.

What I have tried:

I have tried the below options

1) changing the value as 1 and 2
options.AddUserProfilePreference("profile.default_content_settings.popups", 1);

2) options.addArguments("--disable-popup-blocking");

3) options.AddExcludedArgument("disable-popup-blocking");

Nothing worked.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900