public class ByLabel
extends org.openqa.selenium.By
An implementation of By which can find HTML elements by the element's label.
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| Modifier and Type | Field and Description |
|---|---|
static String |
XPATH_LABEL_TEXT_CONTAINS_RELATIVE
The XPATH for matching a label that contains the text.
|
static String |
XPATH_LABEL_TEXT_CONTAINS_ROOT
The XPATH for matching a label that contains the text.
|
static String |
XPATH_LABEL_TEXT_EXACT_RELATIVE
The XPATH for matching a label with exact text.
|
static String |
XPATH_LABEL_TEXT_EXACT_ROOT
The XPATH for matching a label with exact text.
|
| Constructor and Description |
|---|
ByLabel(String labelId)
ByLabel using the label's ID.
|
ByLabel(String labelText,
boolean partialMatch)
ByLabel using the label's text, either as an exact or partial match.
|
ByLabel(String labelText,
boolean partialMatch,
boolean relative)
ByLabel using the label's text, either as an exact or partial match and using a relative XPATh to explicitly look 'inside' the current element.
|
| Modifier and Type | Method and Description |
|---|---|
List<org.openqa.selenium.WebElement> |
findElements(org.openqa.selenium.SearchContext context)
Find the elements by label.
|
public static final String XPATH_LABEL_TEXT_EXACT_ROOT
public static final String XPATH_LABEL_TEXT_CONTAINS_ROOT
public static final String XPATH_LABEL_TEXT_EXACT_RELATIVE
public static final String XPATH_LABEL_TEXT_CONTAINS_RELATIVE
public ByLabel(String labelId)
labelId - the ID of the label.public ByLabel(String labelText, boolean partialMatch, boolean relative)
labelText - the text used to find the labelpartialMatch - whether it can be a partial text matchrelative - whether to use a relative xpath lookuppublic ByLabel(String labelText, boolean partialMatch)
labelText - the text used to find the label.partialMatch - whether it can be a partial text match.public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.SearchContext context)
findElements in class org.openqa.selenium.Bycontext - the search context.Copyright © 2024. All rights reserved.