Hi Ashish,
I am unable to find the element under the Shadow root using selenium locators like cssSelector, i am using Java, selenium ..... pleae help me asap.
for below html.. i need locator for Preferences
I got the sample code from google, Its required 3 lines of code, but every element required 3 lines of code to finde under shaddow root?
Please let me know any alternative solution.
// 1) Locate the shadow host (an element that owns a shadow root)
WebElement host = driver.findElement(By.cssSelector("my-component"));
// 2) Get its shadow root
SearchContext shadowRoot = host.getShadowRoot();
// 3) Find elements inside using CSS selectors
WebElement innerButton = shadowRoot.findElement(By.cssSelector("button.primary"));
innerButton.click();
Thanks
krishna