public class

By

extends Object
java.lang.Object
   ↳ android.support.test.uiautomator.By

Class Overview

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".

Summary

Public Methods
static BySelector checkable(boolean isCheckable)
Constructs a new BySelector and sets the checkable criteria.
static BySelector checked(boolean isChecked)
Constructs a new BySelector and sets the checked criteria.
static BySelector clazz(Pattern className)
Constructs a new BySelector and sets the class name criteria.
static BySelector clazz(String className)
Constructs a new BySelector and sets the class name criteria.
static BySelector clazz(Class clazz)
Constructs a new BySelector and sets the class name criteria.
static BySelector clazz(String packageName, String className)
Constructs a new BySelector and sets the class name criteria.
static BySelector clickable(boolean isClickable)
Constructs a new BySelector and sets the clickable criteria.
static BySelector copy(BySelector original)
Constructs a new BySelector and copies the criteria from original.
static BySelector depth(int depth)
Constructs a new BySelector and sets the depth criteria.
static BySelector desc(Pattern contentDescription)
Constructs a new BySelector and sets the content description criteria.
static BySelector desc(String contentDescription)
Constructs a new BySelector and sets the content description criteria.
static BySelector descContains(String substring)
Constructs a new BySelector and sets the content description criteria.
static BySelector descEndsWith(String substring)
Constructs a new BySelector and sets the content description criteria.
static BySelector descStartsWith(String substring)
Constructs a new BySelector and sets the content description criteria.
static BySelector enabled(boolean isEnabled)
Constructs a new BySelector and sets the enabled criteria.
static BySelector focusable(boolean isFocusable)
Constructs a new BySelector and sets the focusable criteria.
static BySelector focused(boolean isFocused)
Constructs a new BySelector and sets the focused criteria.
static BySelector hasChild(BySelector childSelector)
Constructs a new BySelector and adds a child selector criteria.
static BySelector hasDescendant(BySelector descendantSelector, int maxDepth)
Constructs a new BySelector and adds a descendant selector criteria.
static BySelector hasDescendant(BySelector descendantSelector)
Constructs a new BySelector and adds a descendant selector criteria.
static BySelector longClickable(boolean isLongClickable)
Constructs a new BySelector and sets the long clickable criteria.
static BySelector pkg(String applicationPackage)
Constructs a new BySelector and sets the application package name criteria.
static BySelector pkg(Pattern applicationPackage)
Constructs a new BySelector and sets the application package name criteria.
static BySelector res(String resourceName)
Constructs a new BySelector and sets the resource name criteria.
static BySelector res(Pattern resourceName)
Constructs a new BySelector and sets the resource id criteria.
static BySelector res(String resourcePackage, String resourceId)
Constructs a new BySelector and sets the resource name criteria.
static BySelector scrollable(boolean isScrollable)
Constructs a new BySelector and sets the scrollable criteria.
static BySelector selected(boolean isSelected)
Constructs a new BySelector and sets the selected criteria.
static BySelector text(Pattern regex)
Constructs a new BySelector and sets the text value criteria.
static BySelector text(String text)
Constructs a new BySelector and sets the text value criteria.
static BySelector textContains(String substring)
Constructs a new BySelector and sets the text value criteria.
static BySelector textEndsWith(String substring)
Constructs a new BySelector and sets the text value criteria.
static BySelector textStartsWith(String substring)
Constructs a new BySelector and sets the text value criteria.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static BySelector checkable (boolean isCheckable)

Constructs a new BySelector and sets the checkable criteria.

public static BySelector checked (boolean isChecked)

Constructs a new BySelector and sets the checked criteria.

See Also

public static BySelector clazz (Pattern className)

Constructs a new BySelector and sets the class name criteria.

See Also

public static BySelector clazz (String className)

Constructs a new BySelector and sets the class name criteria.

See Also

public static BySelector clazz (Class clazz)

Constructs a new BySelector and sets the class name criteria.

See Also

public static BySelector clazz (String packageName, String className)

Constructs a new BySelector and sets the class name criteria.

public static BySelector clickable (boolean isClickable)

Constructs a new BySelector and sets the clickable criteria.

public static BySelector copy (BySelector original)

Constructs a new BySelector and copies the criteria from original.

public static BySelector depth (int depth)

Constructs a new BySelector and sets the depth criteria.

public static BySelector desc (Pattern contentDescription)

Constructs a new BySelector and sets the content description criteria.

See Also

public static BySelector desc (String contentDescription)

Constructs a new BySelector and sets the content description criteria.

See Also

public static BySelector descContains (String substring)

Constructs a new BySelector and sets the content description criteria.

public static BySelector descEndsWith (String substring)

Constructs a new BySelector and sets the content description criteria.

public static BySelector descStartsWith (String substring)

Constructs a new BySelector and sets the content description criteria.

public static BySelector enabled (boolean isEnabled)

Constructs a new BySelector and sets the enabled criteria.

See Also

public static BySelector focusable (boolean isFocusable)

Constructs a new BySelector and sets the focusable criteria.

public static BySelector focused (boolean isFocused)

Constructs a new BySelector and sets the focused criteria.

See Also

public static BySelector hasChild (BySelector childSelector)

Constructs a new BySelector and adds a child selector criteria.

public static BySelector hasDescendant (BySelector descendantSelector, int maxDepth)

Constructs a new BySelector and adds a descendant selector criteria.

public static BySelector hasDescendant (BySelector descendantSelector)

Constructs a new BySelector and adds a descendant selector criteria.

public static BySelector longClickable (boolean isLongClickable)

Constructs a new BySelector and sets the long clickable criteria.

public static BySelector pkg (String applicationPackage)

Constructs a new BySelector and sets the application package name criteria.

See Also

public static BySelector pkg (Pattern applicationPackage)

Constructs a new BySelector and sets the application package name criteria.

See Also

public static BySelector res (String resourceName)

Constructs a new BySelector and sets the resource name criteria.

See Also

public static BySelector res (Pattern resourceName)

Constructs a new BySelector and sets the resource id criteria.

See Also

public static BySelector res (String resourcePackage, String resourceId)

Constructs a new BySelector and sets the resource name criteria.

public static BySelector scrollable (boolean isScrollable)

Constructs a new BySelector and sets the scrollable criteria.

public static BySelector selected (boolean isSelected)

Constructs a new BySelector and sets the selected criteria.

public static BySelector text (Pattern regex)

Constructs a new BySelector and sets the text value criteria.

See Also

public static BySelector text (String text)

Constructs a new BySelector and sets the text value criteria.

See Also

public static BySelector textContains (String substring)

Constructs a new BySelector and sets the text value criteria.

public static BySelector textEndsWith (String substring)

Constructs a new BySelector and sets the text value criteria.

public static BySelector textStartsWith (String substring)

Constructs a new BySelector and sets the text value criteria.