java javascript polymer selenium shadow-dom

How to automate shadow DOM elements using selenium?

I am using Java Selenium project for web page automation. The web page contains lots of multi-level shadow-root DOM elements that I am not able to interact with using selenium findElement method.

I have tried the following solutions:

  • deep css (Don’t work on latest chrome browser)
  • JS Executor. (This is really tedious and becomes complex to maintain)


If you know any other solution other than listed above that I can implement in Selenium Java framework , please pass on the solution. Thanks in advance !.