shadow-dom

Access shadow root content with selenium

Access shadow root content with selenium Question: I’m trying to accept the cookie pop up on http://www.immobilienscout24.de. I’m using selenium 4.61, webdriver-manger with chrome, python 3.11 and Fedora 37, but I’m always getting an error. I’m using the following code driver = webdriver.Chrome(ChromeDriverManager().install()) def accept_cookies(): shadow_root = WebDriverWait(driver, 2).until(EC.presence_of_element_located((By.CSS_SELECTOR, "#usercentrics-root"))).shadow_root shadow_root.find_element((By.CLASS_NAME, "sc-gsDKAQ fWOgSr")).click() url = …

Total answers: 1

Best way to click a button within #shadow-root (open) via Python and Selenium

Best way to click a button within #shadow-root (open) via Python and Selenium Question: I am currently dabbling in Python in combination with Selenium. Here I came across the topic of Java Script buttons. I am looking for the smartest way to find out how to execute a Java-Script code (in this case a button) …

Total answers: 1

How to accept cookies popup using Selenium Python

How to accept cookies popup within #shadow-root (open) using Selenium Python Question: I am trying to press the accept button in a cookies popup in the website https://www.immobilienscout24.de/ Snapshot: I understand that this requires driver.execute_script("""return document.querySelector(‘#usercentrics-root’)""") But I can’t trickle down the path to the accept button in order to click it. Can anyone provide …

Total answers: 2

How to extract info within a #shadow-root (open) using Selenium Python?

How to extract info within a #shadow-root (open) using Selenium Python? Question: I got the next url related to an online store https://www.tiendasjumbo.co/buscar?q=mani and I can’t extract the product label an another fields: from selenium import webdriver import time from random import randint driver = webdriver.Firefox(executable_path= "C:Program Files (x86)geckodriver.exe") driver.implicitly_wait(10) time.sleep(4) url = "https://www.tiendasjumbo.co/buscar?q=mani" driver.maximize_window() …

Total answers: 1

Accessing Shadow DOM tree with Selenium

Accessing Shadow DOM tree with Selenium Question: Is it possible to access elements within a Shadow DOM using Selenium/Chrome webdriver? Using the normal element search methods doesn’t work, as is to be expected. I’ve seen references to the switchToSubTree spec on w3c, but couldn’t locate any actual docs, examples, etc. Anyone had success with this? …

Total answers: 9