How to auto accept location popup in firefox browser using Selenium

4 Likes

To accept the location popup in firefox you can set the preference in the FirefoxProfile with Desired Capabilities before accessing the URL in your test case such as:

  1. allow,
  2. block
 WebDriver driver ;
    FirefoxProfile prof = new FirefoxProfile();
    prof.setPreference(“permissions.default.desktop-notification”, 1);
    DesiredCapabilities capabilities=DesiredCapabilities.firefox();
    capabilities.setCapability(FirefoxDriver.PROFILE, prof);
    driver = new FirefoxDriver(capabilities);
    driver.get(“URL”);
2 Likes