I am creating some end-to-end tests for a web app using Selenium.
I am working in Python and using the Firefox driver
driver = webdriver.Firefox()
The problem is that my web app using HTML5 geolocation, and it seems that everytime I run my tests, I have to click the 'Allow Location' popup in Firefox, making my tests less than automated.
Is there a way to force the Selenium Firefox driver to always allow geolocation without prompting?
You can force browser to return some predefined location without permission requests.
Just execute the following JavaScript code:
"navigator.geolocation.getCurrentPosition = function(success) { success({coords: {latitude: 50.455755, longitude: 30.511565}}); }"
Tested in Firefox and Chrome.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With