public
class
By
extends Object
| java.lang.Object | |
| ↳ | android.support.test.uiautomator.By |
By is a utility class which enables the creation of BySelectors in a concise
manner.
Its primary function is to provide static factory methods for constructing BySelectors
using a shortened syntax. For example, you would use findObject(By.text("foo")) rather
than findObject(new BySelector().text("foo")) to select UI elements with the text value
"foo".
Public methods | |
|---|---|
static
BySelector
|
checkable(boolean isCheckable)
Constructs a new |
static
BySelector
|
checked(boolean isChecked)
Constructs a new |
static
BySelector
|
clazz(String packageName, String className)
Constructs a new |
static
BySelector
|
clazz(Class clazz)
Constructs a new |
static
BySelector
|
clazz(Pattern className)
Constructs a new |
static
BySelector
|
clazz(String className)
Constructs a new |
static
BySelector
|
clickable(boolean isClickable)
Constructs a new |
static
BySelector
|
copy(BySelector original)
Constructs a new |
static
BySelector
|
depth(int depth)
Constructs a new |
static
BySelector
|
desc(String contentDescription)
Constructs a new |
static
BySelector
|
desc(Pattern contentDescription)
Constructs a new |
static
BySelector
|
descContains(String substring)
Constructs a new |
static
BySelector
|
descEndsWith(String substring)
Constructs a new |
static
BySelector
|
descStartsWith(String substring)
Constructs a new |
static
BySelector
|
enabled(boolean isEnabled)
Constructs a new |
static
BySelector
|
focusable(boolean isFocusable)
Constructs a new |
static
BySelector
|
focused(boolean isFocused)
Constructs a new |
static
BySelector
|
hasChild(BySelector childSelector)
Constructs a new |
static
BySelector
|
hasDescendant(BySelector descendantSelector)
Constructs a new |
static
BySelector
|
hasDescendant(BySelector descendantSelector, int maxDepth)
Constructs a new |
static
BySelector
|
longClickable(boolean isLongClickable)
Constructs a new |
static
BySelector
|
pkg(Pattern applicationPackage)
Constructs a new |
static
BySelector
|
pkg(String applicationPackage)
Constructs a new |
static
BySelector
|
res(String resourceName)
Constructs a new |
static
BySelector
|
res(String resourcePackage, String resourceId)
Constructs a new |
static
BySelector
|
res(Pattern resourceName)
Constructs a new |
static
BySelector
|
scrollable(boolean isScrollable)
Constructs a new |
static
BySelector
|
selected(boolean isSelected)
Constructs a new |
static
BySelector
|
text(Pattern regex)
Constructs a new |
static
BySelector
|
text(String text)
Constructs a new |
static
BySelector
|
textContains(String substring)
Constructs a new |
static
BySelector
|
textEndsWith(String substring)
Constructs a new |
static
BySelector
|
textStartsWith(String substring)
Constructs a new |
Inherited methods | |
|---|---|
java.lang.Object
| |
BySelector checkable (boolean isCheckable)
Constructs a new BySelector and sets the checkable criteria.
| Parameters | |
|---|---|
isCheckable |
boolean
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector checked (boolean isChecked)
Constructs a new BySelector and sets the checked criteria.
| Parameters | |
|---|---|
isChecked |
boolean
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector clazz (String packageName, String className)
Constructs a new BySelector and sets the class name criteria.
| Parameters | |
|---|---|
packageName |
String
|
className |
String
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector clazz (Class clazz)
Constructs a new BySelector and sets the class name criteria.
| Parameters | |
|---|---|
clazz |
Class
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector clazz (Pattern className)
Constructs a new BySelector and sets the class name criteria.
| Parameters | |
|---|---|
className |
Pattern
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector clazz (String className)
Constructs a new BySelector and sets the class name criteria.
| Parameters | |
|---|---|
className |
String
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector clickable (boolean isClickable)
Constructs a new BySelector and sets the clickable criteria.
| Parameters | |
|---|---|
isClickable |
boolean
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector copy (BySelector original)
Constructs a new BySelector and copies the criteria from original.
| Parameters | |
|---|---|
original |
BySelector
|
| Returns | |
|---|---|
BySelector |
|
BySelector depth (int depth)
Constructs a new BySelector and sets the depth criteria.
| Parameters | |
|---|---|
depth |
int
|
| Returns | |
|---|---|
BySelector |
|
BySelector desc (String contentDescription)
Constructs a new BySelector and sets the content description criteria.
| Parameters | |
|---|---|
contentDescription |
String
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector desc (Pattern contentDescription)
Constructs a new BySelector and sets the content description criteria.
| Parameters | |
|---|---|
contentDescription |
Pattern
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector descContains (String substring)
Constructs a new BySelector and sets the content description criteria.
| Parameters | |
|---|---|
substring |
String
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector descEndsWith (String substring)
Constructs a new BySelector and sets the content description criteria.
| Parameters | |
|---|---|
substring |
String
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector descStartsWith (String substring)
Constructs a new BySelector and sets the content description criteria.
| Parameters | |
|---|---|
substring |
String
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector enabled (boolean isEnabled)
Constructs a new BySelector and sets the enabled criteria.
| Parameters | |
|---|---|
isEnabled |
boolean
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector focusable (boolean isFocusable)
Constructs a new BySelector and sets the focusable criteria.
| Parameters | |
|---|---|
isFocusable |
boolean
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector focused (boolean isFocused)
Constructs a new BySelector and sets the focused criteria.
| Parameters | |
|---|---|
isFocused |
boolean
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector hasChild (BySelector childSelector)
Constructs a new BySelector and adds a child selector criteria.
| Parameters | |
|---|---|
childSelector |
BySelector
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector hasDescendant (BySelector descendantSelector)
Constructs a new BySelector and adds a descendant selector criteria.
| Parameters | |
|---|---|
descendantSelector |
BySelector
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector hasDescendant (BySelector descendantSelector, int maxDepth)
Constructs a new BySelector and adds a descendant selector criteria.
| Parameters | |
|---|---|
descendantSelector |
BySelector
|
maxDepth |
int
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector longClickable (boolean isLongClickable)
Constructs a new BySelector and sets the long clickable criteria.
| Parameters | |
|---|---|
isLongClickable |
boolean
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector pkg (Pattern applicationPackage)
Constructs a new BySelector and sets the application package name criteria.
| Parameters | |
|---|---|
applicationPackage |
Pattern
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector pkg (String applicationPackage)
Constructs a new BySelector and sets the application package name criteria.
| Parameters | |
|---|---|
applicationPackage |
String
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector res (String resourceName)
Constructs a new BySelector and sets the resource name criteria.
| Parameters | |
|---|---|
resourceName |
String
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector res (String resourcePackage, String resourceId)
Constructs a new BySelector and sets the resource name criteria.
| Parameters | |
|---|---|
resourcePackage |
String
|
resourceId |
String
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector res (Pattern resourceName)
Constructs a new BySelector and sets the resource id criteria.
| Parameters | |
|---|---|
resourceName |
Pattern
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector scrollable (boolean isScrollable)
Constructs a new BySelector and sets the scrollable criteria.
| Parameters | |
|---|---|
isScrollable |
boolean
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector selected (boolean isSelected)
Constructs a new BySelector and sets the selected criteria.
| Parameters | |
|---|---|
isSelected |
boolean
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector text (Pattern regex)
Constructs a new BySelector and sets the text value criteria.
| Parameters | |
|---|---|
regex |
Pattern
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector text (String text)
Constructs a new BySelector and sets the text value criteria.
| Parameters | |
|---|---|
text |
String
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector textContains (String substring)
Constructs a new BySelector and sets the text value criteria.
| Parameters | |
|---|---|
substring |
String
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector textEndsWith (String substring)
Constructs a new BySelector and sets the text value criteria.
| Parameters | |
|---|---|
substring |
String
|
| Returns | |
|---|---|
BySelector |
|
See also:
BySelector textStartsWith (String substring)
Constructs a new BySelector and sets the text value criteria.
| Parameters | |
|---|---|
substring |
String
|
| Returns | |
|---|---|
BySelector |
|
See also: