public class ViewElement extends BaseUiElement<android.view.View,ViewElement>
ATTRIB_NOT_VISIBLE, ATTRIB_VISIBLE_BOUNDS
Constructor and Description |
---|
ViewElement(DroidDriverContext<android.view.View,ViewElement> context,
android.view.View view,
ViewElement parent)
A snapshot of all attributes is taken at construction.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doPerformAndWait(java.util.concurrent.FutureTask<java.lang.Boolean> futureTask,
long timeoutMillis) |
protected java.util.Map<Attribute,java.lang.Object> |
getAttributes() |
protected java.util.List<ViewElement> |
getChildren() |
InputInjector |
getInjector()
Gets the
InputInjector for injecting InputEvent. |
ViewElement |
getParent()
Gets the parent.
|
android.view.View |
getRawElement()
Gets the raw element used to create this UiElement.
|
android.graphics.Rect |
getVisibleBounds()
Gets the UiElement bounds in screen coordinates.
|
boolean |
isVisible() |
static void |
overrideClassName(java.lang.String actualClassName,
java.lang.String overridingClassName)
Typically users find the class name to use in tests using SDK tool
uiautomatorviewer.
|
click, doPerform, doubleClick, get, getBounds, getChildren, getClassName, getContentDescription, getPackageName, getResourceId, getSelectionEnd, getSelectionStart, getText, hasSelection, isCheckable, isChecked, isClickable, isEnabled, isFocusable, isFocused, isLongClickable, isPassword, isScrollable, isSelected, longClick, perform, scroll, setText, setUiElementActor, setValidator, toString
public ViewElement(DroidDriverContext<android.view.View,ViewElement> context, android.view.View view, ViewElement parent)
ViewElement
instance are immutable. If the underlying view is
updated, a new ViewElement
instance will be created in
DroidDriver.refreshUiElementTree()
.public static void overrideClassName(java.lang.String actualClassName, java.lang.String overridingClassName)
AccessibilityNodeInfo.getClassName()
. If the app uses custom View
classes that do not call AccessibilityNodeInfo.setClassName(java.lang.CharSequence)
with
the actual class name, different types of drivers see different class names
(InstrumentationDriver sees the actual class name, while UiAutomationDriver
sees AccessibilityNodeInfo.getClassName()
).
If tests fail with InstrumentationDriver, find the actual class name by
examining app code or by calling
DroidDriver.dumpUiElementTree(java.lang.String)
, then
call this method in setUp to override it with the class name seen in
uiautomatorviewer.
public android.graphics.Rect getVisibleBounds()
UiElement
public boolean isVisible()
public ViewElement getParent()
UiElement
protected java.util.List<ViewElement> getChildren()
getChildren
in class BaseUiElement<android.view.View,ViewElement>
protected java.util.Map<Attribute,java.lang.Object> getAttributes()
getAttributes
in class BaseUiElement<android.view.View,ViewElement>
public InputInjector getInjector()
UiElement
InputInjector
for injecting InputEvent.protected void doPerformAndWait(java.util.concurrent.FutureTask<java.lang.Boolean> futureTask, long timeoutMillis)
doPerformAndWait
in class BaseUiElement<android.view.View,ViewElement>
public android.view.View getRawElement()
BaseUiElement
getRawElement
in class BaseUiElement<android.view.View,ViewElement>