1

I am making a tinder auto swipe using Selenium. I am using a firefox browser to run the script and the script is written in python. I want to handle pop up like this but unable to handle it. I have use driver.switch_to.alert.accept() but its returning exception' raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoAlertPresentException: Message: '

shivam
  • 33
  • 5
  • [Always Allow Geolocation in Firefox using Selenium](https://stackoverflow.com/a/21144965/13149512) – AomineDaici May 03 '20 at 13:54
  • You can check the [LINK](https://stackoverflow.com/questions/38767551/how-can-i-handle-geo-location-popup-in-browser-using-selenium-webdriver) and try possible solutions. – Raj May 03 '20 at 14:35
  • thanks but i was looking for python code and in the link its written in java. – shivam May 03 '20 at 23:27

1 Answers1

0

You can try to set the preference in the options before opening the page. Try this:

geo_location = webdriver.FirefoxOptions()
geo_location.set_preference('geo.prompt.testing', True)
geo_location.set_preference('geo.prompt.testing.allow', True)
# This will mock a certain location:
geo_location.set_preference('geo.provider.network.url',
    'data:application/json,{"location": {"lat": 10.0, "lng": 10.0}, "accuracy": 100.0}')

# Pass options into the profile and open your page
driver = webdriver.Firefox(options=geo_location)
driver.get('https://tinder.com/app/recs')

I hope this helps, it worked for me. Good luck!

Svetlana Levinsohn
  • 1,550
  • 3
  • 10
  • 19