Created
April 22, 2024 07:15
-
-
Save SarahElson/bca587c60a84acbb8e63ba1a1aee151d to your computer and use it in GitHub Desktop.
How to Handle Shadow Root in Selenium Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public WebElement fileMenu() { | |
final WebElement shadowHost = getDriver().findElement(By.cssSelector(".smart-ui-component")); | |
final SearchContext shadowRoot = shadowHost.getShadowRoot(); | |
return shadowRoot.findElement(By.cssSelector(".smart-element .smart-menu-main-container .smart-element")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment