Dec-26-2022, 12:19 PM
Hi! why does't it click on the 'agree' button?
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time
driver = webdriver.Chrome(ChromeDriverManager().install())
wait = WebDriverWait(driver, 10)
driver.get('https://www.youtube.com/2lnyn02')
agree_buton = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="yDmH0d"]/c-wiz/div/div/div/div[2]/div[1]/div[3]/div[2]/form[1]/div/div/button')))
agree_buton.click()
time.sleep(500)Error: driver = webdriver.Chrome(ChromeDriverManager().install())
DevTools listening on ws://127.0.0.1:56716/devtools/browser/0d4aac93-886e-46b5-bb49-ba6cbde3a56d
[6732:6344:1226/142232.382:ERROR:device_event_log_impl.cc(215)] [14:22:32.382] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Traceback (most recent call last):
File "d:\python visio\automation\web scrapping\api_web\acces_youtube_info.py", line 12, in <module>
agree_buton = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="yDmH0d"]/c-wiz/div/div/div/div[2]/div[1]/div[3]/div[2]/form[1]/div/div/button')))
File "C:\Users\i_han\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\support\wait.py", line 87, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
