Closed floa93 closed 1 year ago
To access elements within a ShadowRoot
you first have to find the custom element on the page. Then you can get the shadowRoot
for it, and last but not least another time find element has to be used to actually get the wanted element.
Your given code doesn't do that at all. It only retrieves the body and tries to print the text which indeed is empty. Right now we do not have Find Element in ShadowRoot
support with geckodriver but it will be added soon. You can wait for issue #2005 to be fixed, or use Execute Script
to get to the element.
As such I'm going to close this issue.
Thanks for the response. The example was just to show the differences of the text function, since some test frameworks are implementing their "i should see ..." test steps using the body visible text. The Javascript workaround using ExecuteScript and innerText is working fine and thanks for the link to the other issue.
System
Testcase
Start the firefox using the selenium docker command:
docker run -d -p 4444:4444 --shm-size="2g" selenium/standalone-firefox:4.8.1-20230221
I used the UI5 documentation page for the example which is using shadow roots.
The use case is that I want to check if my page contains for example an UI5 table with cell containing "Smartcards":![image](https://user-images.githubusercontent.com/19166198/222378964-210a1620-5384-434e-ba82-e85b4342911c.png)
Stacktrace
Firefox returns "" instead of the table. The output looks like this on firefox:(I removed the bottom unnecessary part)
So the visible HTML is the example below the real table and the real table is not "seen" on the page.
Compared to Chrome v110:
If i go into the firefox browser on my desktop (win11) and i use JS then i see the text in .innerText
document.body.innerText
Trace-level log
Thanks