Reputation: 91
I'm testing an application using java-selenium Webdriver where there are some shadow-dom elements. How can I test them for Firefox driver?
I tried the following code
WebElement ele = (WebElement) ((JavascriptExecutor)driver).executeScript("return arguments[0].shadowRoot",element);
return ele;
This works for Chrome. But for Firefox, I get a "Javascript Exception: Cyclic object error". Could you please help
Upvotes: 3
Views: 1546
Reputation: 391
Not a fix, but as a work around..
Instead of "return arguments[0].shadowRoot" use "return arguments[0].shadowRoot.children" This will return a collection of the root nodes and you can index or use your favorite collection query method to move forward.
Upvotes: 3