搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

Learn More

How to enable popup blocker using selenium and geckodriver

  • 无回复
  • 1 人有此问题
  • 5 次查看
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.