如何处理这个特定的弹窗…这只在火狐浏览器中发生。

huangapple go评论90阅读模式
英文:

how to handle this particular popup..this occurs only in firefox

问题

I am doing an automation learning project in this web site. https://www.shoppersstop.com/ and when using selenium Firefox browser, i got this particular popup.. i tried with firefox options to block it, but thats not working,, any help is appreciated...

System.setProperty("webdriver.gecko.driver", "src\test\resources\drivers\geckodriver.exe");
FirefoxOptions Options = new FirefoxOptions();
Options.addPreference("dom.disable_beforeunload", true);
driver = new FirefoxDriver(Options);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

英文:

如何处理这个特定的弹窗…这只在火狐浏览器中发生。I am doing an automation learning project in this web site. https://www.shoppersstop.com/ and when using selenium Firefox browser, i got this particular popup.. i tried with firefox options to block it, but thats not working,, any help is appreciated...

System.setProperty("webdriver.gecko.driver", "src\\test\\resources\\drivers\\geckodriver.exe");
FirefoxOptions Options = new FirefoxOptions();
Options.addPreference("dom.disable_beforeunload", true);
driver = new FirefoxDriver(Options);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);][1]][1]

答案1

得分: 1

你可以使用配置属性来禁用这个功能:

FirefoxOptions Options = new FirefoxOptions();
Options.addPreference("dom.disable_beforeunload", true);
final FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("geo.enabled", false);
profile.setPreference("geo.provider.use_corelocation", false);
profile.setPreference("geo.prompt.testing", false);
profile.setPreference("geo.prompt.testing.allow", false);
options.setProfile(profile);
driver = new FirefoxDriver(Options);
英文:

You can disable this with profile properties:

FirefoxOptions Options = new FirefoxOptions();
Options.addPreference("dom.disable_beforeunload", true);
final FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("geo.enabled", false);
profile.setPreference("geo.provider.use_corelocation", false);
profile.setPreference("geo.prompt.testing", false);
profile.setPreference("geo.prompt.testing.allow", false);
options.setProfile(profile);
driver = new FirefoxDriver(Options);

huangapple
  • 本文由 发表于 2020年7月30日 06:10:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/63163172.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定