Ausgabe
Mein Code ist:
WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.XPATH, "//option[@value='/icpplustieb/citar?p=8&locale=es']"))).click()
Die URL lautet: https://icp.administracionelectronica.gob.es/icpplus/index.html
Ich möchte Barcelona als Region auswählen.
Lösung
Verwenden Sie die select()
Selenklasse
select =Select(WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.XPATH, "//select[@id='form']"))))
select.select_by_visible_text("Barcelona")
Sie müssen die folgende Bibliothek importieren.
from selenium.webdriver.support.ui import Select
Beantwortet von – KunduK
Antwort geprüft von – Mildred Charles (FixError Admin)