I am trying to find a workaround to automatically allow geolocation sharing from my scripts (Webdriver Java API). I would like to prevent the geolocation dialog box from popping up during scripts execution.

I found a few solutions for GC and FF and they all work.

For FF setting profile preferences :

FirefoxProfile ffprofile = new FirefoxProfile ();
ffprofile.setPreference("geo.prompt.testing", true);
ffprofile.setPreference("geo.prompt.testing.allow" , true);
driver = new FirefoxDriver(ffprofile);

For GC JavaScript:

if (driver instanceof JavascriptExecutor) {
((JavascriptExecutor)driver).executeScript("naviga tor.geolocation.getCurrentPosition = function(success) { success({coords: {latitude: xxxx, longitude: -yyyy}}); }");

The above don't work for IE. Does anybody have an idea how to implement it in IE?

Thanks in advance!