1

After allowing for "all the site to get your physical location" using chrome setting, still popup getting populated. How to handle geo location popup using java selenium? Can anyone please help me?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
selen
  • 11
  • 1
  • Have you searched for similar questions already? [question 1](http://stackoverflow.com/questions/34721359/chrome-profile-to-disable-know-your-location-pop-up/34723230#34723230) [question 2](http://stackoverflow.com/questions/28390611/how-can-i-allow-location-access-using-selenium/28390721#28390721) – JDelorean Aug 18 '16 at 11:05
  • Both the way i have tried,but its not working for me. – selen Aug 26 '16 at 09:25

1 Answers1

1

To disable this message you need to add chrome options:

options.addArguments("--enable-strict-powerful-feature-restrictions");
options.addArguments("--disable-geolocation");

Full example:

public WebDriver createDriver(){
    ChromeOptions options = new ChromeOptions();
    options.addArguments("disable-infobars");
    options.addArguments("disable-notifications");
    options.addArguments("--enable-strict-powerful-feature-restrictions");
    options.addArguments("--disable-geolocation");
    return new ChromeDriver(options);
}
splekhanov
  • 116
  • 1
  • 2
  • 9