Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: "detached shadow root" not translated to DetachedShadowRootException #13580

Open
joerg1985 opened this issue Feb 14, 2024 · 10 comments

Comments

@joerg1985
Copy link
Member

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

Copy link

@joerg1985, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@joerg1985
Copy link
Member Author

the same issue should exist for "insecure certificate" -> InsecureCertificateException

@nvborisenko
Copy link
Member

@joerg1985
Copy link
Member Author

The java client has been fixed in 1cdf5b4

@nvborisenko
Copy link
Member

You motivated me, fixed in .net too: 8405299

@diemol
Copy link
Member

diemol commented Feb 16, 2024

Can we close this?

@joerg1985
Copy link
Member Author

@nvborisenko i think the "insecure certificate" -> InsecureCertificateException is still missing in c#?

@diemol When searching for "detached shadow root" in the repo i can only find c# / java / js code, so probably other bindings are still missing this?

@diemol
Copy link
Member

diemol commented Feb 16, 2024

@titusfortner, do you know?

@titusfortner
Copy link
Member

guessing this got added to spec and not updated in our code

@aguspe
Copy link
Contributor

aguspe commented Jul 19, 2024

@titusfortner @p0deje would you let me know if adding the extra test here #14267 is enough in this case?

And if it is and the PR gets merged, could we remove the C-rb label? I'm trying to go through all the ruby open bugs and it helps me to filter better, thank you so much 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants