[英]How to disable geolocation permissions for a website using firefox capabilities in selenium webdriver
I want to disable the geolocation permissions for a website using firefox capabilities in selenium webdriver, but i am not able to do so. 我想在Selenium Webdriver中使用Firefox功能禁用网站的地理位置许可,但是我不能这样做。
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 附件是相同的屏幕截图
I haven't tried with your specific parameter but for others it works well, like this: 我没有尝试使用您的特定参数,但对于其他参数来说,效果很好,如下所示:
FirefoxProfile profile = new FirefoxProfile();
// Turn off updates
profile.setPreference("app.update.enabled", false);
WebDriver driver = new FirefoxDriver(profile);
Using Selenium 2.48 and FF 42.0 (but it should do for other versions, as well. 使用Selenium 2.48和FF 42.0(但其他版本也应如此)。
这对我有用
caps.setCapability("locationContextEnabled", false);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.