How to disable location service by chromedriver selenium? How to disable location service by chromedriver selenium? selenium selenium

How to disable location service by chromedriver selenium?


Yes, it's possible.Use the ChromeOptions class, in the following way:

 ChromeOptions options = new ChromeOptions(); JSONObject jsonObject = new JSONObject(); jsonObject.put("profile.default_content_settings.geolocation", 2); options.setExperimentalOption("prefs", jsonObject); WebDriver driver = new ChromeDriver(options);

You can see it as an answer for an issue here