SNow toolbar - How to access Shadow element xpath using selenium Java.

samirmantri
Tera Contributor

Description: SNow toolbar - Shadow element xpath access issue using selenium Java.

We've to locate elements from toolbar (e.g., Impersonate User, Clicking on "All" tab) using selenium Java. However, we've observed that there are nested Shadow elements on the page and we're facing issue while identifying the same.
So, could someone please check and help us on how to locate SNow toolbar - Shadow element xpath using selenium Java?

1 REPLY 1

Tushar
Kilo Sage
Kilo Sage

Hi @samirmantri 

 

To access shadow DOM elements in ServiceNow using Selenium and Java, I think you need to first locate the shadow host element, then use JavaScript execution to retrieve the shadow root, and finally interact with the elements inside it. 

 

Thanks.