Are XPath selectors properly supported in BiDi mode? #14275
Replies: 4 comments
-
Thanks for raising the issue @aDifferentUser , any chance you can create a reproduction case? |
Beta Was this translation helpful? Give feedback.
-
Hi @christian-bromann I can reproduce it with this simple example using Chrome 134:
spec.ts
The CSS selector works as expected. But the XPath selector does not work at all and raises the metioned warning before failing:
|
Beta Was this translation helpful? Give feedback.
-
@aDifferentUser I created an issue for this. Any contributions would be much appreciated. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We currently use WDIO v9 in "classic mode" and want to switch over to BiDi mode. The main reason for this is to benefit from the new “Automatic Shadow Root Piercing”.
When I run our tests in BiDi mode, the log gets flooded with these messages:
[0-0] 2025-03-12T10:54:45.253Z WARN webdriverio: Failed to execute browser.browsingContextLocateNodes({ ... }) due to Error: WebDriver Bidi command "browsingContext.locateNodes" failed with error: unknown error - Unexpected error in selector script: NotSupportedError: Failed to execute 'evaluate' on 'XPathExpression': The node provided is '#document-fragment', which is not a valid context node type., falling back to regular WebDriver Classic command
This message gets logged every time a XPath selector gets evaluated when there is a shadow root present on the test page. Even the targeted element is not inside a shadow root.
Is this expected behaviour?
I could not find any documentation or reported issue about this.
Beta Was this translation helpful? Give feedback.
All reactions