public abstract static class RS.XPATH
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AND
and
|
static java.lang.String |
END
]
|
static java.lang.String |
MATCHING_ALL_START
//*[, it is used as beginning to construct an xpath for searching elements under ENTIRE document.
|
static java.lang.String |
MATCHING_DIV_START
//DIV[, it is used as beginning to construct an xpath for searching DIV elements under ENTIRE document.
|
static java.lang.String |
OR
or
|
static java.lang.String |
RELATIVE_MATCHING_ALL_START
.//*[, it is used as beginning to construct an xpath for searching elements under current WebElement.
|
static java.lang.String |
RELATIVE_MATCHING_DIV_START
.//DIV[, it is used as beginning to construct an xpath for searching DIV elements under current WebElement.
|
static java.lang.String |
TRUE_CONDITION
(1=1), an always true condition to concatenate other conditions to create an XPAH for searching.
|
Constructor and Description |
---|
XPATH() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
condition(java.lang.String attribute,
java.lang.String value,
boolean partialMatch) |
static java.lang.String |
conditionContains(java.lang.String attribute,
java.lang.String value) |
static java.lang.String |
conditionForText(java.lang.String text,
boolean partialMatch) |
static java.lang.String |
fromAttribute(java.lang.String attribute,
java.lang.String value,
boolean partial,
boolean relative)
Create an xpath by (attribute, value) for searching webelement within direct and indirect children.
|
static java.lang.String |
fromText(java.lang.String text,
boolean partial,
boolean relative)
Create an xpath by text for searching webelement within direct and indirect children.
|
static java.lang.String |
html()
return '/html'
|
static boolean |
isRootHtml(org.openqa.selenium.SearchContext sc) |
protected static java.lang.String |
quote(java.lang.String text)
Add single quote around the text (such as 'text'), and it will be used in XPATH for searching a web element in DOM.
If the text (such as Tom's) contains single quote, we cannot simply quote the text with single quote, which will cause the error; instead we will use the function concat() to connect each part of the text, such as concat('Tom', "'", 's'). |
static java.lang.String |
RELATIVE_MATCHING_TAG_START(java.lang.String tag) |
public static final java.lang.String MATCHING_ALL_START
public static final java.lang.String RELATIVE_MATCHING_ALL_START
public static final java.lang.String MATCHING_DIV_START
public static final java.lang.String RELATIVE_MATCHING_DIV_START
public static final java.lang.String TRUE_CONDITION
public static final java.lang.String END
public static final java.lang.String AND
public static final java.lang.String OR
public static final java.lang.String html()
public static java.lang.String RELATIVE_MATCHING_TAG_START(java.lang.String tag)
tag
- Ex: span, table, ul, etc..public static java.lang.String fromText(java.lang.String text, boolean partial, boolean relative)
text
- String, the text of a webelement. can be regex if XPATH2.0partial
- boolean, if the parameter text is part of the webelement's contentrelative
- boolean, if true then searching elements under current WebElement; false then searching elements under ENTIRE document.public static java.lang.String fromAttribute(java.lang.String attribute, java.lang.String value, boolean partial, boolean relative)
attribute
- String, the attribute namevalue
- String, the attribute's value, can be regex if XPATH2.0.partial
- boolean, if the parameter value is part of the webelement's attributerelative
- boolean, if true then searching elements under current WebElement; false then searching elements under ENTIRE document.public static java.lang.String condition(java.lang.String attribute, java.lang.String value, boolean partialMatch)
attribute
- String, the attribute namevalue
- String, the expected value of the attributepartialMatch
- boolean, if the attribute value will be matched partially (considered as a substring)#getCondition(String, boolean)
public static java.lang.String conditionContains(java.lang.String attribute, java.lang.String value)
attribute
- String, the attribute name ending with "contains"value
- String, the expected substring value of the attribute#getCondition(String, boolean)
public static java.lang.String conditionForText(java.lang.String text, boolean partialMatch)
text
- String, the text valuepartialMatch
- boolean, if the text's value will be matched partially (considered as a substring)protected static java.lang.String quote(java.lang.String text)
text
- String, the text of the web element.public static boolean isRootHtml(org.openqa.selenium.SearchContext sc)
Copyright © SAS Institute. All Rights Reserved.