How can I handle Geo Location popup in browser using selenium webdriver?

后端 未结 2 746
轻奢々
轻奢々 2020-12-19 22:28

I want to share my location on click of \'Share Location\' button on the popup. How can I handle this using selenium webdriver? Refer image below.

Steps to reach to

2条回答
  •  臣服心动
    2020-12-19 22:53

        FirefoxProfile geoDisabled = new FirefoxProfile();
        geoDisabled.setPreference("geo.enabled", false);
        geoDisabled.setPreference("geo.provider.use_corelocation", false);
        geoDisabled.setPreference("geo.prompt.testing", false);
        geoDisabled.setPreference("geo.prompt.testing.allow", false);
        DesiredCapabilities capabilities = DesiredCapabilities.firefox();
        capabilities.setCapability(FirefoxDriver.PROFILE, geoDisabled);
    
        WebDriver driver;
        System.setProperty("Driver_Name", "Driver_path");
        driver =new FirefoxDriver(geoDisabled);
    

    Need to pass the instance of FirefoxProfile.

提交回复
热议问题