Created
March 23, 2017 02:25
-
-
Save Khalian/b8d837c4fcb19746205d417302d0eeab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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