如何使用硒铬驱动程序处理地理位置弹出窗口
How to handle Geo location popup using Selenium chromedriver?
当使用selenium网络驱动程序在chrome浏览器中启动Web应用程序时,地理位置(地理位置)弹出窗口出现在浏览器顶部。
因此,我的一些基于位置的测试用例失败了。
如何使用chromedriver处理这些场景?
"When ever launching the web-app in chrome browser using selenium webdriver,
Geo-location(Geo Location) Pop up is coming on the top of the browser."
在这种情况下,您可能会尝试如下操作:
@BeforeMethod
public void clearPopup() {
driver.navigate().refresh();
Thread.sleep(2000);//wait until the page is loaded.
//try to use explicit wait
try {
Alert alert = driver.switchTo().alert();
alert.dismiss();
} catch (NoAlertPresentException ex) {
//System.out.println("No alert for this test case.");
}
}
此方法将在所有测试用例之前运行,如果有任何弹出窗口显示,它将消除警报。
我也浏览了你的网址。 当我单击呼叫地理位置 API 时,会显示一个弹出窗口。您可以通过执行以下操作来停止此类弹出窗口:
-go to settings of chrome and click on advanced settings.
-than click on content settings under privacy.
-than u will see pop ups and location options.
在那里形成选择您想要的选项。 选择
"Allow all sites to track ur physical location"
如果您不想看到弹出窗口。
相关文章:
- 安卓平台上的QWebView HTML5地理位置
- Possibile使用Manifest v2下的HTML5地理位置API将lat/long转换为国家/地区
- 如何在javascript清单中获取地理位置权限
- 地理位置和计算从当前纬度/液化天然气到另一纬度/液化石油气的距离
- 询问用户是否要打开地理位置
- 使用html5地理位置api创建地理围栏
- javascript显示地理位置
- 在地图加载/页面加载时,我想将地图设置为当前地理位置,但不想在地图上显示定位图标
- 为大型地理位置的坐标生成浮点数
- 根据客户的地理位置、邮政编码和位置切换图像
- HTML5地理位置,询问位置
- 谷歌地图/GMAP3 - 绘制从用户地理位置到已知目的地的路线 - 需要帮助
- 移动浏览器、地理位置和自动填充地址
- j查询地理位置和地图突出显示
- Javascript 地理位置:将坐标存储在数组中
- 地理位置无法返回确认
- 如何使用硒铬驱动程序处理地理位置弹出窗口
- 捕获用户单击“允许浏览器地理位置请求”弹出窗口时的确切时刻
- 具有信息窗口内容和用户地理位置的多个制造商
- 如何处理用户关闭地理位置弹出窗口时的情况