2

I am trying to use Webdriver to test a location aware website and would like to programatically (using WebDriver API call) click on the "Share Location" button that pops up when I click on a link to the location aware part of the web application.

It is a browser prompt and does not seem to be a DOM element or javascript popup element.

imsaar
  • 49
  • 1
  • 6

3 Answers3

5

In case anyone is interested in knowing... I don't believe you can use the webdriver to click that button since it's not in the DOM (ie. not part of the web document) as suggested by other answers. However, you can create firefox profiles to manipulate geolocations or change the "Share Location" setting to "Allow" in Firefox.

See the following link for more info: http://selenium.polteq.com/nl/change-geolocation-in-firefox-with-selenium-webdriver/

Kuromi
  • 66
  • 1
  • 2
  • in FF 28 when I open about:permissions there is no "Allow" option under "Share Location". Only "Always Ask" or "Block". – andy Apr 30 '14 at 16:52
1

You should start Firefox manually once - and select the profile you use for Selenium.

Type about:permissions in the address line; find the name of your host - and select share location : "allow".

That's all. Now your Selenium test cases will not see that dreaded browser dialog which is not in the DOM.

tbsalling
  • 4,477
  • 4
  • 30
  • 51
0

You can try locating by xpath //input[@value="Share Location"] is it is an <input type=button>, or probably you can try //button[contains(., "Share Location")] if it is a <button> element

Sergii Pozharov
  • 17,366
  • 4
  • 29
  • 30