Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How to enable popup blocker using selenium and geckodriver

  • No replies
  • 1 has this problem
  • 4 views
more options

I test a large website using Selenium (3.14) and the most current geckodriver. I have Firefox 97.0 installed (on windows 10).

I would like to enable popup blocking for some of my tests. With most browsers I set options and use a line like:

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

For Firefox the setting seems to be in the FirefoxProfile - but i cannot find the correct syntax to use to create and set the settings.

My instantiation currently looks like this:

                       driver = new FirefoxDriver(driverDirectory);
                       driver.Manage().Timeouts().PageLoad = TimeSpan.FromMinutes(1.0d);

I looks to me like I can pass a profile instead of a directory, but i can't see how to do that. (Clearly the profile would need to point to the right directory and also set the enabling of the popup blocker).

Would appreciate any help.

I test a large website using Selenium (3.14) and the most current geckodriver. I have Firefox 97.0 installed (on windows 10). I would like to enable popup blocking for some of my tests. With most browsers I set options and use a line like: options.AddExcludedArgument("disable-popup-blocking"); For Firefox the setting seems to be in the FirefoxProfile - but i cannot find the correct syntax to use to create and set the settings. My instantiation currently looks like this: driver = new FirefoxDriver(driverDirectory); driver.Manage().Timeouts().PageLoad = TimeSpan.FromMinutes(1.0d); I looks to me like I can pass a profile instead of a directory, but i can't see how to do that. (Clearly the profile would need to point to the right directory and also set the enabling of the popup blocker). Would appreciate any help.