2

Need help to block save address pop up coming in chrome browser while executing selenium c# automation scripts.

enter image description here

Following all options already tried but no luck.

IWebDriver driver;
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("--disable-single-click-autofill"); 
chromeOptions.AddArgument("--disable-popup-blocking");
chromeOptions.AddExcludedArgument("--disable-infobars");
chromeOptions.AddAdditionalChromeOption("useAutomationExtension", "false"); 
chromeOptions.AddArgument("--disable-notifications");
chromeOptions.AddUserProfilePreference("disable-popup-blocking", "true");
new WebDriverManager.DriverManager().SetUpDriver(new ChromeConfig());
driver = new ChromeDriver(chromeOptions);
4
  • Does this answer your question? How to disable chrome's "save password" popup in selenium webdriver (python)
    – SimonC
    Nov 9, 2022 at 14:26
  • I used this to block username password save pop up which is working but Save address is still coming beacsue of which script failing.
    – Sonal
    Nov 9, 2022 at 14:48
  • Curious: How does the popup make your script fail? "Save address?" is popping up in my scripts too, but it doesn't seem to disrupt the script. Nov 9, 2022 at 17:07
  • After analysis script is not failing because of this pop up (failing due to some scripts and wait issues) but still unable to close or prevent this pop up with above code. Thank you for help and suggestions!
    – Sonal
    Nov 10, 2022 at 10:53

1 Answer 1

3

I was able to turn off the Save Address prompt using AddUserProfilePreference. It is called "autofill.profile_enabled". You can just add it to your ChromeOptions and pass those options in when instantiating the driver.

I got the name from this Reddit post: https://www.reddit.com/r/selenium/comments/yicwf0/chromium_how_to_disable_save_and_autofill_address/

ChromeOptions options = new ChromeOptions();
            options.AddArgument("start-maximized");
            options.AddArgument("test-type");
            options.AddArgument("disable-notifications");
            options.AddUserProfilePreference("autofill.profile_enabled", false);

            IWebDriver webDriver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), options, TimeSpan.FromSeconds(240));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.