-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Not supported exceptions when use findelements() on shadow-root - affects By.name, By.tagName, By.xpath #4971
Comments
For exception 1 and 2: As workaround, ShadowRoot elements has getElementById, querySelector and querySelectorAll functions. For exception 3: For selenium, I think ShadowRoot should be handled like an IFrame and requires .SwitchTo as it has its own context. |
Now, for your code to work. Here is a sample using C# to get the links of each product on the page. Output:
Code:
|
Closing this to consolidate on #5869 |
Meta -
OS:
Windows 7
Selenium Version:
3.6.0
Browser:
Chrome, but not relevant in fact
Browser Version:
not relevant
Expected Behavior -
When used:
By.name("list")
than the element will be found with the 'name' attribute, not with 'tagName'. And of course will be found and possible to interract without errors.That affect both attributes - name and tagName should be possible to use on these WebElements.
For xpath - I expect that xpath will be correct processed.
Actual Behavior -
for name attribute (1):
org.openqa.selenium.WebDriverException: unknown error: a.getElementsByTagName is not a function
for tagName attribute (2):
org.openqa.selenium.WebDriverException: unknown error: b.getElementsByTagName is not a function
for Xpath (3):
org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the xpath expression .//shop-list because of the following error:
NotSupportedError: Failed to execute 'evaluate' on 'Document': The node provided is '#document-fragment', which is not a valid context node type.
Steps to reproduce -
Site: https://shop.polymer-project.org/
This site is with Polymer written, so for every component there comes shadow root (Shadow DOM) - that's why I need to use expandRootElement method.
The text was updated successfully, but these errors were encountered: