Нажмите веб-страницу Chrome в Python, используя селен.Python

Программы на Python
Anonymous
Нажмите веб-страницу Chrome в Python, используя селен.

Сообщение Anonymous »

по этой ссылке https://bancadatistatisticaoas.inail.it ... _e_Servizi
Мне нужно нажать «F Costruzioni», а затем F 41 COSTRUZIONI ED EDIFICI.
Это мой код, но он не работает. Что я делаю не так?
# Initialize the WebDriver
driver = webdriver.Chrome(options=chrome_options)
driver.maximize_window()

try:
# Navigate to the page
driver.get(
"https://bancadatistatisticaoas.inail.it ... _e_Servizi"
)
wait = WebDriverWait(driver, 90)

# f_costruzioni_button = wait.until(EC.element_to_be_clickable((By.XPATH, "//span[text()='F COSTRUZIONI']")))
# f_costruzioni_button.click()

wait.until(EC.element_to_be_clickable((By.XPATH, "//table/tbody/tr/td[text()='F COSTRUZIONI']"))).click()

# This is a simple sleep; for a more robust solution, check the download directory for a new file
import time

time.sleep(10)

finally:
# Clean up by closing the browser
driver.quit()


Подробнее здесь: https://stackoverflow.com/questions/787 ... g-selenium

Вернуться в «Python»