Vyhľadajte odpoveď

Vyhnite sa podvodom s podporou. Nikdy vás nebudeme žiadať, aby ste zavolali alebo poslali SMS na telefónne číslo alebo zdieľali osobné informácie. Nahláste prosím podozrivú aktivitu použitím voľby “Nahlásiť zneužitie”.

Learn More

How to enable popup blocker using selenium and geckodriver

  • Žiadne odpovede
  • 1 má tento problém
  • 4 zobrazenia
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.