Skip to content

Instantly share code, notes, and snippets.

@Khalian
Created March 23, 2017 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Khalian/b8d837c4fcb19746205d417302d0eeab to your computer and use it in GitHub Desktop.
Save Khalian/b8d837c4fcb19746205d417302d0eeab to your computer and use it in GitHub Desktop.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
# Download the gecko driver https://github.com/mozilla/geckodriver/releases and put in your path env var
driver = webdriver.Firefox()
driver.get("https://www.google.com/maps/")
elem = driver.find_element_by_id("searchbox")
# Simulates just typing the words in the google maps search box
elem.send_keys("Mumbai")
elem.send_keys(Keys.RETURN)
# elem.send_keys is non blocking, so a sleep for the url to get current.
time.sleep(5)
print driver.current_url
# Output seen : https://www.google.com/maps/place/Mumbai,+Maharashtra,+India/@19.0826111,72.6009814,10z/data=!4m5!3m4!1s0x3be7c6306644edc1:0x5da4ed8f8d648c69!8m2!3d19.0759837!4d72.8776559
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment