如何在selenium webdriver中使用Firefox功能禁用网站的地理位置权限 [英] How to disable geolocation permissions for a website using firefox capabilities in selenium webdriver
本文介绍了如何在selenium webdriver中使用Firefox功能禁用网站的地理位置权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想禁用在selenium webdriver中使用Firefox功能的网站的地理位置权限,但我无法这样做。
我试过这样做.. 。
WebDriver d = null;
cap = cap.merge(DesiredCapabilities.firefox());
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(geo.enabled,false);
cap.setCapability(geo.provider.use_corelocation,false);
cap.setCapability(geo.prompt.testing,false);
cap.setCapability(geo.prompt.testing.allow,false);
附件是相同的截图
解决方案
caps.setCapability(locationContextEnabled,false);
I want to disable the geolocation permissions for a website using firefox capabilities in selenium webdriver, but i am not able to do so.
I tried doing this...
WebDriver d = null;
cap = cap.merge(DesiredCapabilities.firefox());
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("geo.enabled", false);
cap.setCapability("geo.provider.use_corelocation", false);
cap.setCapability("geo.prompt.testing", false);
cap.setCapability("geo.prompt.testing.allow", false);
Attached is the screenshot of the same
解决方案
This worked for me
caps.setCapability("locationContextEnabled", false);
这篇关于如何在selenium webdriver中使用Firefox功能禁用网站的地理位置权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文