public final class AtomAction
extends Object implements ViewAction
| java.lang.Object | |
| ↳ | android.support.test.espresso.web.action.AtomAction<E> |
一个ViewAction,它可以在webview中对提供的Atom进行评估。
不建议直接使用AtomAction。
取而代之的是如何通过Atom与WebView内容交互的例子。
如果您必须直接使用AtomAction,请注意记住它们是有状态的(与大多数ViewActions不同),并且调用方必须调用{@ #get()}以确保操作已完成。
也可以看看:
Public constructors |
|
|---|---|
AtomAction(Atom<E> atom, WindowReference window, ElementReference element) 创建一个AtomAction。 |
|
Public methods |
|
|---|---|
E |
get(long val, TimeUnit unit) 直到原子通过可配置的超时完成执行为止。 |
E |
get() 阻塞直到原子完成执行。 |
Matcher<View> |
getConstraints() ViewActions的一种机制来指定它们可以操作的视图类型。 |
String |
getDescription() 返回视图操作的描述。 |
Future<E> |
getFuture() 回报未来,这将从futureEval中设置和转化。 |
void |
perform(UiController controller, View view) 在给定视图上执行此操作。 |
Inherited methods |
|
|---|---|
java.lang.Object
|
|
android.support.test.espresso.ViewAction
|
|
AtomAction (Atom<E> atom, WindowReference window, ElementReference element)
创建一个AtomAction。
| Parameters | |
|---|---|
atom |
Atom: the atom to execute |
window |
WindowReference: (optional/nullable) the window context to execute on. |
element |
ElementReference: (optional/nullable) the element to execute on. |
E get (long val,
TimeUnit unit)
直到原子通过可配置的超时完成执行为止。
| Parameters | |
|---|---|
val |
long
|
unit |
TimeUnit
|
| Returns | |
|---|---|
E |
|
| Throws | |
|---|---|
ExecutionException |
|
InterruptedException |
|
TimeoutException |
|
E get ()
阻塞直到原子完成执行。
| Returns | |
|---|---|
E |
|
| Throws | |
|---|---|
ExecutionException |
|
InterruptedException |
|
Matcher<View> getConstraints ()
ViewActions的一种机制来指定它们可以操作的视图类型。 ViewAction可以要求传递的视图符合某些约束。 例如,它可能希望确保视图已经在设备的可视物理屏幕中或具有某种类型。
| Returns | |
|---|---|
Matcher<View> |
a Matcher that will be tested prior to calling perform. |
String getDescription ()
返回视图操作的描述。 描述不应该太长,并且应该很好地适用于以下这样的句子:“对带ID的视图执行%description%动作...”
| Returns | |
|---|---|
String |
|
Future<E> getFuture ()
回报未来,这将从futureEval中设置和转化。 Espresso的公共API在它的方法签名中不能有番石榴类型,所以返回Future而不是ListenableFuture或SettableFuture。
| Returns | |
|---|---|
Future<E> |
|
void perform (UiController controller, View view)
在给定视图上执行此操作。
| Parameters | |
|---|---|
controller |
UiController: the controller to use to interact with the UI. |
view |
View: the view to act upon. never null. |