Does anybody know how to identify shadow dom web elements using selenium webdriver?

Viewed 15445

We are using selenium web driver and python for our test automation and trying to automate html5 app with shadow dom design. Unable to identify any elements that come under shadow-root. For eg. If I want to access any element under the shadow root given below then how can I do that? Any help is appreciated.

enter image description here

2 Answers

You could try this way also

driver.execute_script('return document.querySelector("neon-animatable").shadowRoot.querySelector(".flex")')

Related