I'm using playwright for web automation and I have come into a scenario where I need to capture the error message for validation. The error text is inside the shadow-root and the selector I used captures the web element correctly but returns an empty string when I valide the text. Is there any way we can do this? Can we use Javascript executor for this?
Asked
Active
Viewed 355 times
0
-
Locators should naturally expand shadow roots, so there should be no special code necessary. Can you share your attempt so far, and preferably the complete HTML or page you're manipulating? Thanks. – ggorlen Nov 28 '22 at 06:13
-
Since it is an "open" shadowRoot. Have you tried ``document.querySelector("fx-tooltip").shadowRoot.innerHTML``? – Danny '365CSI' Engelman Nov 28 '22 at 08:29