-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!C-pyPython BindingsPython BindingsD-chromeI-defectSomething is not working as intendedSomething is not working as intendedI-regressionSomething was working but we "fixed" itSomething was working but we "fixed" itOS-windows
Description
Description
I tried to access the shadow DOM. I have trouble to use the identified shadow root.
See code below.
When I try to access via shadowroot / shadowroot2 I get an error
AttributeError: 'ShadowRoot' object has no attribute 'id'. Did you mean: '_id'?
Actually, this is right because wether I use the direct javascript or the shadow_root property, I get an object with just a property "_id". I am pretty sure it worked in the past.
If I do a shadowroot.id = shadowroot._id it works again.
I guess evaluation fo shadowroot is buggy (or is it a webdriver issue ?)
Selenium was updated.
Reproducible Code
from selenium import webdriver as WebDriver
from selenium.webdriver.common.by import By
webdriver = WebDriver.Chrome()
webdriver.get("https://www.consorsbank.de/home")
shadowhost = webdriver.find_element(By.XPATH,"//wb-website-header")
# works
queryselector = "arguments[0].shadowRoot.querySelectorAll('div > button#header-login-button')"
elt1 = webdriver.execute_script(f"return {queryselector}", shadowhost)
# works not any more
queryselector = "arguments[0].querySelectorAll('div > button#header-login-button')"
shadowroot = webdriver.execute_script("return arguments[0].shadowRoot", shadowhost)
try:
elt2a = webdriver.execute_script(f"return {queryselector}", shadowroot)
except:
pass
shadowroot2 = shadowhost.shadow_root
try:
elt2b = webdriver.execute_script(f"return {queryselector}", shadowroot2)
except:
pass
ℹ️ Last known working version: 4.25 but earlier Chrome / Chromedriver
Metadata
Metadata
Assignees
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!C-pyPython BindingsPython BindingsD-chromeI-defectSomething is not working as intendedSomething is not working as intendedI-regressionSomething was working but we "fixed" itSomething was working but we "fixed" itOS-windows