Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

Learn More

How to enable popup blocker using selenium and geckodriver

  • Aucune réponse
  • 1 a ce problème
  • 5 vues
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.