Hola a todos, solo quiero hacer clic en este botón con python mi código:
Main_page=webdriver.Chrome(options=chrome_options,service=chrome_service) base_url="https://www.cbs.gov.il/he/Statistics/Pages/%D7%9E%D7%97%D7%95%D7%9C%D7%9C%D7%99%D7%9D/%D7%9E%D7%97%D7%95%D7%9C%D7%9C-%D7%AA%D7%90%D7%95%D7%A0%D7%95%D7%AA.aspx" Main_page.get(base_url) Main_page.maximize_window() time.sleep(10) button = Main_page.find_element(By.NAME, 'ישראל כולל יהודה ושומרון') button.click()Puedo averiguar por qué no funciona
error: oSuchElementException: Mensaje: no existe tal elemento: No se puede ubicar el elemento: {"método":"css selector","selector":"[name="ישראל כולל יהודה ושומרון"]"} (Información de la sesión: chrome=102.0. 5005.63)
consulte este artículo https://www.geeksforgeeks.org/click-element-method-selenium-python/
NOTA: también puede usar xpath para encontrar elementos
element = driver.find_element_by_xpath("//a[@id='link']")NOTA: puede copiar xpath desde cualquier navegador aquí es cómo encontrar xpath en los navegadores
button = Main_page.find_element(By.NAME, 'ישראל כולל יהודה ושומרון') button.click() intenta encontrar elementos por nombre, pero שראל כולל יהודה ושומרון no es un nombre html o xml válido, es un texto interno del botón, intente encontrar usando xpath como mencioné antes o encuéntrelo por id