Daniel Williams
Daniel Williams

Reputation: 9304

Selenium testing with GeoLocate- FireFox keeps turning it off

I am running tests on a location-aware site. I can tell Chrome or IE to always allow geo-locate for that one page, but Firefox always forgets once I close the browser.

Anyone else ever encounter this?

Upvotes: 2

Views: 1174

Answers (1)

nmaier
nmaier

Reputation: 33162

The Selenium driver for Firefox seems to create a new, anonymous profile with each run by default. Hence your settings won't persist, as they will be discarded together with the profile after a run.

You should:

  • Set up your FirefoxProfile instance to use .setPreference("geo.prompt.testing", true); and .setPreference("geo.prompt.testing.allow", true);.
  • or set up an existing profile with the either the above preferences or explicitly allow your site. Then set the webdriver.firefox.profile Java System property or use the public FirefoxProfile(File profileDir) constructor to use that existing profile.

Upvotes: 4

Related Questions