Issue
This is the button I want to press:
def obtenerCoordenadasDirección():
header = {"User-Agent": "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11"}
driver = webdriver.Chrome('chromedriver.exe')
driver.maximize_window()
adresses="Calle Urb. La Arbor"
driver.get('https://www.google.com/maps/search/'+adresses)
print(driver.current_url)
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(1)
driver.find_element_by_css_selector('body > div.box > div:nth-child(5) > form >
input.button').click()
obtenerCoordenadasDirección()
I tried looking for id,class,xpath and value but it didn't work. Also I saw that it`s because the iframe so I need to change it but I don't really know how to do it. In the code above I tried with css.selector but it neither work.
Solution
Using xpath to find the button worked for me:
from selenium import webdriver
import time
driver = webdriver.Chrome('C:/Chromedriver/chromedriver.exe')
driver.get('https://www.google.com/maps/search/Calle Urb. La Arbor')
driver.maximize_window()
time.sleep(1) #wait for site to load
driver.find_element_by_xpath('/html/body/c-wiz/div/div/div/div[2]/div[1]/div[4]/form/div[1]/div/button/span').click()
Answered By - Dani_K
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.