简体   繁体   中英

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.

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.

这对我有用

caps.setCapability("locationContextEnabled", false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM