Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Learn More

How to enable popup blocker using selenium and geckodriver

  • Нет ответов
  • 1 имеет эту проблему
  • 6 просмотров
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.