您的位置:首页 > 移动开发 > Objective-C

UiObject2 API的简单译文

2016-01-29 16:29 771 查看

UiObject2 API的简单译文

extends Object

Package android.support.test.uiautomator

Class Overview

A UiObject2 represents a UI element. Unlike UiObject, it is bound to a particular view instance and can become stale if the underlying view object is destroyed. As a result, it may be necessary to call findObject(BySelector) to obtain a new UiObject2 instance
if the UI changes significantly.

UiObject2代表一个UI元素。和UiObject不同,它是绑定到一个特定的视图实例,如果它的底层视图对象被摧毁,它可能会过时。因此,如果UI变化显著它可能需要调用findObject(BySelector)获得一个新的UiObject2实例。

void clear()

Clears the text content if this object is an editable field.

如果此对象是一个编辑区域,就清空编辑区域的内容。

void click()

Clicks on this object.

点击此对象。

<R> R clickAndWait(EventCondition<R> condition, long timeout)

Clicks on this object, and waits for the given condition to become true.

点击此对象,并等待给出的条件成立。

void drag(Point dest, int speed)

Drags this object to the specified location.

拖动此对象到指定位置。

void drag(Point dest)

Drags this object to the specified location.

拖动此对象到指定位置。

boolean equals(Object object)

判断对象是否一致

UiObject2 findObject(BySelector selector)

Searches all elements under this object and returns the first object to match the criteria.

搜索此类下面的所有元素,并返回符合搜索条件的第一个对象。

List<UiObject2> findObjects(BySelector selector)

Searches all elements under this object and returns all objects that match the criteria.

搜索此对象下面的所有元素,并返回符合搜索条件的第一个对象。

boolean fling(Direction direction)

Performs a fling gesture on this object.

在此对象上面执行一个指定方向的fling手势动作。

boolean fling(Direction direction, int speed)

Performs a fling gesture on this object.

在此对象上面执行一个指定方向的fling手势动作

String getApplicationPackage()

Returns the package name of the app that this object belongs to.

返回此对象的应用的包名。

int getChildCount()

Returns the number of child elements directly under this object.

返回此对象下面包含的子元素的数目。

List<UiObject2> getChildren()

Returns a collection of the child elements directly under this object.

返回此对象下面包含的子对象的集合。

String getClassName()

Returns the class name of the underlying View represented by this object.

返回由该对象表示的低层实图的类名。

String getContentDescription()

Returns the content description for this object.

返回此对象description属性的内容。

UiObject2 getParent()

Returns this object's parent.

返回此对象的父元素。

String getResourceName()

Returns the fully qualified resource name for this object's id.

返回此对象的resourceId属性值。

String getText()

Returns the text value for this object.

返回此对象的text属性的值。

Rect getVisibleBounds()

Returns the visible bounds of this object in screen coordinates.

返回此对象在屏幕中的视图坐标。

Point getVisibleCenter()

Returns a point in the center of the visible bounds of this object.

返回此对象的中心点坐标。

boolean hasObject(BySelector selector)

Returns whether there is a match for the given criteria under this object.

返回在此对象下面是否有符合条件的元素。

int hashCode()

返回哈希值。

boolean isCheckable()

Returns whether this object is checkable.

返回此对象是否可以check(勾上,checkbox属性)

boolean isChecked()

Returns whether this object is checked.

返回此对象是否已经check

boolean isClickable()

Returns whether this object is clickable.

返回该对象是否可以点击

boolean isEnabled()

Returns whether this object is enabled.

返回该对象是否已经启用。

boolean isFocusable()

Returns whether this object is focusable.

返回该对象是否可以获取焦点。

boolean isFocused()

Returns whether this object is focused.

返回该对象是否已将获取焦点。

boolean isLongClickable()

Returns whether this object is long clickable.

返回该对象是否可以长点击。

boolean isScrollable()

Returns whether this object is scrollable.

返回该对象是否可以滚动。

boolean isSelected()

Returns whether this object is selected.

返回该对象是否可以被选中。

void longClick()

Performs a long click on this object.

执行长按动作

void pinchClose(float percent, int speed)

Performs a pinch close gesture on this object.

执行双指捏合(pinch)的关闭手势动作。

void pinchClose(float percent)

Performs a pinch close gesture on this object.

执行双指捏合(pinch)的关闭手势动作。

void pinchOpen(float percent, int speed)

Performs a pinch open gesture on this object.

执行双指的打开手势动作。

void pinchOpen(float percent)

Performs a pinch open gesture on this object.

执行双指的打开手势动作。

void recycle()

Recycle this object

回收此对象。.

boolean scroll(Direction direction, float percent)

Performs a scroll gesture on this object.

对此对象执行滚动操作。

boolean scroll(Direction direction, float percent, int speed)

Performs a scroll gesture on this object.

对此对象执行滚动操作。

void setGestureMargin(int margin)

Sets the margins used for gestures in pixels.

设置手势以像素的幅度操作。

void setG
4000
estureMargins(int left, int top, int right, int bottom)

Sets the margins used for gestures in pixels.

设置手势以像素的幅度操作

void setText(String text)

Sets the text content if this object is an editable field.

如果此对象是一个编辑区域,设置text内容。

void swipe(Direction direction, float percent, int speed)

Performs a swipe gesture on this object.

执行滑动手势。

void swipe(Direction direction, float percent)

Performs a swipe gesture on this object.

执行滑动手势。

<R> R wait(UiObject2Condition<R> condition, long timeout)

Waits for given the condition to be met.

等待给定的条件/事件出现。

<R> R wait(SearchCondition<R> condition, long timeout)

Waits for given the condition to be met.

等待给定的条件/事件出现。

原地址: 点击打开链接
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息