如何使用selenium处理允许Firefox的位置访问警报?

时间:2018-05-21 07:20:45

标签: java selenium testing popup alert

在Firefox中,我已将位置访问权限设置为允许。但仍然显示自动化下面的弹出窗口。怎么解决这个? 我也使用了firefox选项。它不起作用。 场景:我必须从下拉列表中选择一个城市。浏览器显示警报 允许通过两个选项访问此站点。 1.Allow位置, 2.禁止

我必须点击“允许位置”

1 个答案:

答案 0 :(得分:0)

您可以按以下方式禁用通知弹出窗口。

System.setProperty("webdriver.gecko.driver","./Resource/geckodriver.exe");
FirefoxProfile ffprofile = new FirefoxProfile();
ffprofile.setPreference("dom.webnotifications.enabled", false);
WebDriver driver = new FirefoxDriver(ffprofile);
driver.get("https://jabong.com");
相关问题