Question

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.

Was it helpful?

Solution

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/

OTHER TIPS

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top