Closed
Description
What happened?
When using a detached shadow root a DetachedShadowRootException should be raised.
I am pretty sure this happens because the ErrorHandler
does still use the none W3C ErrorCodes
.
It should use ErrorCodec
to decode the error, this will allow to find the newer W3C errors.
How can we reproduce the issue?
var e = driver.findElement(By.tagName("div"));
jse.executeScript("arguments[0].attachShadow({ mode: \"open\" });", e);
var s = e.getShadowRoot();
jse.executeScript("arguments[0].remove();", e);
s.findElements(By.cssSelector("#x"));
Relevant log output
Exception in thread "main" org.openqa.selenium.WebDriverException: detached shadow root: detached shadow root
(Session info: chrome=121.0.6167.161)
Build info: version: '4.18.0-SNAPSHOT', revision: 'f79256f'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [25932ce6ecc2d75dc32b89623da0db21, findElementsFromShadowRoot {value=#x, shadowId=E38CC20229833B455F91A5DF9F1A026B_element_7, using=css selector}]
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 121.0.6167.161, chrome: {chromedriverVersion: 121.0.6167.85 (3f98d690ad7e..., userDataDir: C:\Users\...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:54023}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(), se:cdp: ws://localhost:54023/devtoo..., se:cdpVersion: 121.0.6167.161, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Session ID: 25932ce6ecc2d75dc32b89623da0db21
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:136)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:51)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:190)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:216)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:174)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:519)
at org.openqa.selenium.remote.ElementLocation$ElementFinder$2.findElements(ElementLocation.java:182)
at org.openqa.selenium.remote.ElementLocation.findElements(ElementLocation.java:103)
at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:369)
at org.openqa.selenium.remote.ShadowRoot.findElements(ShadowRoot.java:47)
Operating System
win 10 x64
Selenium version
4.18.0-SNAPSHOT
What are the browser(s) and version(s) where you see this issue?
chrome 121
What are the browser driver(s) and version(s) where you see this issue?
chromedriver 121.0.6167.85
Are you using Selenium Grid?
no