Browser library - Button not clickable inside shadow root

I am using browser library to automate our angular app. However i am not unable to click a button inside this shadow-root. Tried all locators and nothing seem to be working or its not identifying the locator at all

This is my page and //button[@id = ‘undefined’] is my locator

Can someone help me with the above problem I am facing with shadow dom and browser library?

Try using js path

Right click on the element in console (Chrome) > copy > Copy JS path

The element will now be document.queryselector(“#something”).shadow root(“something”)

You might need to add dom: to the beginning

dom:document.queryselector…

Plug that in the place of the //[…] And see what happens

Looks to be a duplicate post of

Linking for visibility of what people have suggested.

1 Like