Jul-17-2022, 09:53 AM
Tried to use WebDriverWait.
Doesn't work either.
Doesn't work either.
from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.common.exceptions import TimeoutException, ElementClickInterceptedException import time options = Options() driver = webdriver.Chrome('/usr/bin/chromedriver', options=options) url = 'https://www.arte.tv/fr/videos/103475-006-A/1-km-a-pied/' driver.get(url) timeout = 10 try: button_lire_plus = WebDriverWait(driver, timeout).until(EC.presence_of_element_located((By.CSS_SELECTOR, '#__next > div > main > div.css-p6yk9l > div.css-5mui6u > div > button'))) button_lire_plus.click() except TimeoutException: print('Failed to locate button') except ElementClickInterceptedException: print('Can\'t click on button') finally: driver.quit() driver.quit()Here is output in shell:
Output:>>>
RESTART: /home/pavel/python_code/explore_arte_with_selenium_test_click_button_v2.py
Can't click on button
>>>