How to disable geolocation permissions for a website using firefox features in selenium webdriver

I want to disable geolocation permissions for a website using firefox capabilities in selenium webdriver, but I cannot do that.

I've 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 a screenshot of the same

enter image description here

+1


source to share


2 answers


I haven't tried with your specific parameter, but for others it works well, for example:

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 this should be done for other versions as well.

0


source


This worked for me



caps.setCapability("locationContextEnabled", false);

      

0


source







All Articles