список реквизитов в виде таблички, что пользователь, якобы, мог что-то разрешить распространять, что-то категорически запретить, а что-то разрешить с ограничениями
from selenium.webdriver.common.by import By
from time import sleep
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager
from selenium import webdriver
driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))
print("Браузер запускается, подождите немного")
try:
driver.get(url="https://podoq.ru")
sleep(7)
for _ in range(1, 9):
driver.execute_script("window.scrollBy(0,document.body.scrollHeight)")
sleep(1)
sleep(4)
print(link)
except Exception as e:
print(e)
finally:
driver.quit()
shadow_host = driver.find_element_by_css_selector('#shadow_host')
shadow_root_dict = driver.execute_script('return arguments[0].shadowRoot', shadow_host)
shadow_root_id = shadow_root_dict['shadow-6066-11e4-a52e-4f735466cecf']
shadow_root = WebElement(driver, shadow_root_id, w3c=True)
shadow_content = shadow_root.find_element_by_css_selector('#shadow_content')
shadow_host = driver.find_element(By.CSS_SELECTOR, '#shadow_host')
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/lev/Desktop/PY/ad_viewer/.venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 738, in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
File "/Users/lev/Desktop/PY/ad_viewer/.venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 344, in execute
self.error_handler.check_response(response)
File "/Users/lev/Desktop/PY/ad_viewer/.venv/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"#shadow_host"}
(Session info: chrome=117.0.5938.132); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/lev/Desktop/PY/ad_viewer/.venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 404, in execute_script
return self.execute(command, {"script": script, "args": converted_args})["value"]
File "/Users/lev/Desktop/PY/ad_viewer/.venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 344, in execute
self.error_handler.check_response(response)
File "/Users/lev/Desktop/PY/ad_viewer/.venv/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.JavascriptException: Message: javascript error: Cannot read properties of null (reading 'querySelector')