public class ByShadow
extends org.openqa.selenium.By
implements org.openqa.selenium.By.Remotable
<div id="shadow-host">
#shadow-root
<input id="shadowedInput"/>
<div id="nested-shadow-host">
#shadow-root
<input id="nestedShadowedInput"/>
</div>
</div>
To find the first input element inside a single-level shadow DOM, you need to provide the locator for the nested element
and the locator for the shadow host element:
ByShadow.cssSelector("#shadowedInput","#shadow-host")
To find the input element inside the nested shadow DOM, you need to provide the locator for the shadowed element,
as well as the list of parent shadow dom locators, rom top to bottom:
ByShadow.cssSelector("#shadowedInput","#shadow-host", "#inner-shadow-host")
| Modifier and Type | Class and Description |
|---|---|
static class |
ByShadow.ByShadowBuilder |
org.openqa.selenium.By.ByClassName, org.openqa.selenium.By.ByCssSelector, org.openqa.selenium.By.ById, org.openqa.selenium.By.ByLinkText, org.openqa.selenium.By.ByName, org.openqa.selenium.By.ByPartialLinkText, org.openqa.selenium.By.ByTagName, org.openqa.selenium.By.ByXPath, org.openqa.selenium.By.Remotable| Modifier | Constructor and Description |
|---|---|
protected |
ByShadow(org.openqa.selenium.By target,
String shadowHost,
String[] innerShadowHosts) |
| Modifier and Type | Method and Description |
|---|---|
static ByShadow.ByShadowBuilder |
css(String target) |
static ByShadow |
cssSelector(org.openqa.selenium.By target,
String shadowHost,
String... innerShadowHosts) |
static ByShadow |
cssSelector(String target,
String shadowHost,
String... innerShadowHosts) |
org.openqa.selenium.WebElement |
findElement(org.openqa.selenium.SearchContext context) |
List<org.openqa.selenium.WebElement> |
findElements(org.openqa.selenium.SearchContext context) |
org.openqa.selenium.By.Remotable.Parameters |
getRemoteParameters() |
static ByShadow.ByShadowBuilder |
located(org.openqa.selenium.By byLocator) |
ByShadow |
thenInHost(String nestedHost) |
String |
toString() |
public static ByShadow cssSelector(String target, String shadowHost, String... innerShadowHosts)
public static ByShadow cssSelector(org.openqa.selenium.By target, String shadowHost, String... innerShadowHosts)
public String toString()
toString in class org.openqa.selenium.Bypublic static ByShadow.ByShadowBuilder css(String target)
public static ByShadow.ByShadowBuilder located(org.openqa.selenium.By byLocator)
public org.openqa.selenium.By.Remotable.Parameters getRemoteParameters()
getRemoteParameters in interface org.openqa.selenium.By.Remotablepublic org.openqa.selenium.WebElement findElement(org.openqa.selenium.SearchContext context)
findElement in class org.openqa.selenium.Bypublic List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.SearchContext context)
findElements in class org.openqa.selenium.ByCopyright © 2023. All rights reserved.