Это элемент -
Код: Выделить всё
CSV
Код: Выделить всё
# Set up the Chrome WebDriver
driver = webdriver.Chrome(options=chrome_options)
# Open the webpage
driver.get('https://www.echa.europa.eu/web/guest/cosmetics-prohibited-substances?p_p_id=eucleflegislationlist_WAR_euclefportlet&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&_eucleflegislationlist_WAR_euclefportlet_cur=1&_eucleflegislationlist_WAR_euclefportlet_substance_identifier_field_key=&_eucleflegislationlist_WAR_euclefportlet_delta=50&_eucleflegislationlist_WAR_euclefportlet_doSearch=&_eucleflegislationlist_WAR_euclefportlet_deltaParamValue=50&_eucleflegislationlist_WAR_euclefportlet_orderByCol=fld_erc2_maxthres&_eucleflegislationlist_WAR_euclefportlet_orderByType=desc')
# Optional: Wait for the page to load
time.sleep(5)
# Step 1: Click the "Accept Disclaimer" button
accept_button = driver.find_element(By.ID, "_viewsubstances_WAR_echarevsubstanceportlet_acceptDisclaimerButton")
accept_button.click()
# Optional: Wait for any page transition after accepting terms
time.sleep(3)
# Step 2: Find the CSV export button and click it to download
csv_button = driver.find_element(By.ID, "_euclegislationlist_WAR_euclefportlet_exportButtonCSV")
csv_button.click()
# Optional: Wait for the download to complete
time.sleep(10)
# Close the browser
driver.quit()
raiseException_class(message, screen, stacktrace)
selenium.common.Exceptions.NoSuchElementException: Сообщение: нет такого элемент: невозможно найти элемент: {"method":"css selector","selector":"[id="_euclegislationlist_WAR_euclefportlet_exportButtonCSV"]"(Информация о сеансе: chrome=129.0.6668.90); Документацию по этой ошибке можно найти по адресу: https://www.selenium.dev/documentation/ ... errors#no- such-element-Exception
Подробнее здесь: https://stackoverflow.com/questions/790 ... ton-python