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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.