1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119<!DOCTYPE html>
120<html devsite>
121<head>
122
123
124    <meta name="top_category" value="develop" />
125
126    <meta name="subcategory" value="reference" />
127
128
129      <meta name="book_path" value="/reference/android/support/test/_book.yaml" />
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145<title>ViewInteraction</title>
146
147
148</head>
149
150<body class="gc-documentation develop reference api apilevel-">
151<div id="doc-api-level" class="" style="display:none"></div>
152
153
154
155
156<div id="naMessage"></div>
157
158<div id="api-info-block">
159<div class="api-level">
160
161
162
163
164</div>
165
166
167
168
169
170
171
172
173
174
175
176<div class="sum-details-links">
177
178Summary:
179
180
181
182
183
184
185
186
187
188
189
190  <a href="#pubmethods">Methods</a>
191
192
193
194
195  &#124; <a href="#inhmethods">Inherited Methods</a>
196
197&#124; <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a>
198
199</div><!-- end sum-details-links -->
200</div><!-- end api-info-block -->
201
202<div class="api apilevel-" id="jd-content">
203
204<!-- ======== START OF CLASS DATA ======== -->
205
206<h1 class="api-title">ViewInteraction</h1>
207<p>
208<code class="api-signature">
209  public
210
211  final
212
213  class
214  ViewInteraction
215</code>
216<br>
217
218
219<code class="api-signature">
220
221    extends Object
222
223
224
225</code>
226
227<code class="api-signature">
228
229
230
231</code>
232
233</p><table class="jd-inheritance-table">
234
235
236  <tr>
237
238    <td colspan="2" class="jd-inheritance-class-cell">java.lang.Object
239    </td>
240  </tr>
241
242
243  <tr>
244
245      <td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;&#x21b3;</td>
246
247    <td colspan="1" class="jd-inheritance-class-cell">android.support.test.espresso.ViewInteraction
248    </td>
249  </tr>
250
251
252</table>
253
254
255
256
257<br><hr>
258
259
260  <p>Provides the primary interface for test authors to perform actions or asserts on views.
261 <p>
262 Each interaction is associated with a view identified by a view matcher. All view actions and
263 asserts are performed on the UI thread (thus ensuring sequential execution). The same goes for
264 retrieval of views (this is done to ensure that view state is "fresh" prior to execution of each
265 operation).
266</p>
267
268
269
270
271
272
273
274<h2 class="api-section">Summary</h2>
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302<!-- ========== METHOD SUMMARY =========== -->
303<table id="pubmethods" class="responsive methods">
304<tr><th colspan="2"><h3>Public methods</h3></th></tr>
305
306
307
308
309  <tr class="api apilevel-" >
310
311
312    <td><code>
313
314
315
316
317
318        <a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a></code>
319    </td>
320
321    <td width="100%">
322      <code>
323      <a href="/reference/android/support/test/espresso/ViewInteraction.html#check(android.support.test.espresso.ViewAssertion)">check</a>(<a href="/reference/android/support/test/espresso/ViewAssertion.html">ViewAssertion</a> viewAssert)
324      </code>
325
326        <p>Checks the given <code><a href="/reference/android/support/test/espresso/ViewAssertion.html">ViewAssertion</a></code> on the the view selected by the current view matcher.
327
328
329</p>
330
331    </td>
332  </tr>
333
334
335
336  <tr class="api apilevel-" >
337
338
339    <td><code>
340
341
342
343
344
345        <a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a></code>
346    </td>
347
348    <td width="100%">
349      <code>
350      <a href="/reference/android/support/test/espresso/ViewInteraction.html#inRoot(org.hamcrest.Matcher<android.support.test.espresso.Root>)">inRoot</a>(Matcher&lt;<a href="/reference/android/support/test/espresso/Root.html">Root</a>&gt; rootMatcher)
351      </code>
352
353        <p>Makes this ViewInteraction scoped to the root selected by the given root matcher.
354
355
356</p>
357
358    </td>
359  </tr>
360
361
362
363  <tr class="api apilevel-" >
364
365
366    <td><code>
367
368
369
370
371
372        <a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a></code>
373    </td>
374
375    <td width="100%">
376      <code>
377      <a href="/reference/android/support/test/espresso/ViewInteraction.html#perform(android.support.test.espresso.ViewAction...)">perform</a>(<a href="/reference/android/support/test/espresso/ViewAction.html">ViewAction...</a> viewActions)
378      </code>
379
380        <p>Performs the given action(s) on the view selected by the current view matcher.
381
382
383</p>
384
385    </td>
386  </tr>
387
388
389
390  <tr class="api apilevel-" >
391
392
393    <td><code>
394
395
396
397
398
399        <a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a></code>
400    </td>
401
402    <td width="100%">
403      <code>
404      <a href="/reference/android/support/test/espresso/ViewInteraction.html#withFailureHandler(android.support.test.espresso.FailureHandler)">withFailureHandler</a>(<a href="/reference/android/support/test/espresso/FailureHandler.html">FailureHandler</a> failureHandler)
405      </code>
406
407        <p>Replaces the default failure handler (@see Espresso.setFailureHandler) with a custom
408 failurehandler for this particular interaction.
409
410
411</p>
412
413    </td>
414  </tr>
415
416
417
418</table>
419
420
421
422
423
424
425
426<!-- ========== METHOD SUMMARY =========== -->
427<table id="inhmethods" class="methods inhtable">
428<tr><th><h3>Inherited methods</h3></th></tr>
429
430
431<tr class="api apilevel-" >
432<td colspan="2">
433
434  <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed"
435          ><img height="34" id="inherited-methods-java.lang.Object-trigger"
436          src="/assets/images/styles/disclosure_down.png"
437          class="jd-expando-trigger-img" /></a>From
438class
439<code>
440
441    java.lang.Object
442
443</code>
444<div id="inherited-methods-java.lang.Object">
445  <div id="inherited-methods-java.lang.Object-list"
446        class="jd-inheritedlinks">
447  </div>
448  <div id="inherited-methods-java.lang.Object-summary" style="display: none;">
449    <table class="jd-sumtable-expando responsive">
450
451
452
453
454  <tr class="api apilevel-" >
455
456
457    <td><code>
458
459
460
461
462
463        Object</code>
464    </td>
465
466    <td width="100%">
467      <code>
468      clone()
469      </code>
470
471    </td>
472  </tr>
473
474
475
476  <tr class="api apilevel-" >
477
478
479    <td><code>
480
481
482
483
484
485        boolean</code>
486    </td>
487
488    <td width="100%">
489      <code>
490      equals(Object arg0)
491      </code>
492
493    </td>
494  </tr>
495
496
497
498  <tr class="api apilevel-" >
499
500
501    <td><code>
502
503
504
505
506
507        void</code>
508    </td>
509
510    <td width="100%">
511      <code>
512      finalize()
513      </code>
514
515    </td>
516  </tr>
517
518
519
520  <tr class="api apilevel-" >
521
522
523    <td><code>
524
525
526
527        final
528
529        Class&lt;?&gt;</code>
530    </td>
531
532    <td width="100%">
533      <code>
534      getClass()
535      </code>
536
537    </td>
538  </tr>
539
540
541
542  <tr class="api apilevel-" >
543
544
545    <td><code>
546
547
548
549
550
551        int</code>
552    </td>
553
554    <td width="100%">
555      <code>
556      hashCode()
557      </code>
558
559    </td>
560  </tr>
561
562
563
564  <tr class="api apilevel-" >
565
566
567    <td><code>
568
569
570
571        final
572
573        void</code>
574    </td>
575
576    <td width="100%">
577      <code>
578      notify()
579      </code>
580
581    </td>
582  </tr>
583
584
585
586  <tr class="api apilevel-" >
587
588
589    <td><code>
590
591
592
593        final
594
595        void</code>
596    </td>
597
598    <td width="100%">
599      <code>
600      notifyAll()
601      </code>
602
603    </td>
604  </tr>
605
606
607
608  <tr class="api apilevel-" >
609
610
611    <td><code>
612
613
614
615
616
617        String</code>
618    </td>
619
620    <td width="100%">
621      <code>
622      toString()
623      </code>
624
625    </td>
626  </tr>
627
628
629
630  <tr class="api apilevel-" >
631
632
633    <td><code>
634
635
636
637        final
638
639        void</code>
640    </td>
641
642    <td width="100%">
643      <code>
644      wait(long arg0, int arg1)
645      </code>
646
647    </td>
648  </tr>
649
650
651
652  <tr class="api apilevel-" >
653
654
655    <td><code>
656
657
658
659        final
660
661        void</code>
662    </td>
663
664    <td width="100%">
665      <code>
666      wait(long arg0)
667      </code>
668
669    </td>
670  </tr>
671
672
673
674  <tr class="api apilevel-" >
675
676
677    <td><code>
678
679
680
681        final
682
683        void</code>
684    </td>
685
686    <td width="100%">
687      <code>
688      wait()
689      </code>
690
691    </td>
692  </tr>
693
694
695
696    </table>
697  </div>
698</div>
699</td></tr>
700
701
702</table>
703
704
705
706<!-- XML Attributes -->
707
708
709<!-- Enum Values -->
710
711
712<!-- Constants -->
713
714
715<!-- Fields -->
716
717
718<!-- Public ctors -->
719
720
721
722<!-- ========= CONSTRUCTOR DETAIL ======== -->
723<!-- Protected ctors -->
724
725
726
727<!-- ========= METHOD DETAIL ======== -->
728<!-- Public methdos -->
729
730<h2 class="api-section">Public methods</h2>
731
732
733
734<A NAME="check(android.support.test.espresso.ViewAssertion)"></A>
735
736<div class="api apilevel-">
737    <h3 class="api-name">check</h3>
738    <div class="api-level">
739      <div></div>
740
741
742
743    </div>
744<pre class="api-signature no-pretty-print">
745<a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a> check (<a href="/reference/android/support/test/espresso/ViewAssertion.html">ViewAssertion</a> viewAssert)</pre>
746
747
748
749
750  <p>Checks the given <code><a href="/reference/android/support/test/espresso/ViewAssertion.html">ViewAssertion</a></code> on the the view selected by the current view matcher.</p>
751    <table class="responsive">
752    <tr><th colspan=2>Parameters</th></tr>
753      <tr>
754        <td><code>viewAssert</code></td>
755        <td width="100%">
756          <code>ViewAssertion</code>:
757          the assertion to check.</td>
758      </tr>
759    </table>
760    <table class="responsive">
761      <tr><th colspan=2>Returns</th></tr>
762      <tr>
763        <td><code><a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a></code></td>
764        <td width="100%">this interaction for further perform/verification calls.
765</td>
766      </tr>
767    </table>
768
769</div>
770
771
772<A NAME="inRoot(org.hamcrest.Matcher<android.support.test.espresso.Root>)"></A>
773
774<div class="api apilevel-">
775    <h3 class="api-name">inRoot</h3>
776    <div class="api-level">
777      <div></div>
778
779
780
781    </div>
782<pre class="api-signature no-pretty-print">
783<a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a> inRoot (Matcher&lt;<a href="/reference/android/support/test/espresso/Root.html">Root</a>&gt; rootMatcher)</pre>
784
785
786
787
788  <p>Makes this ViewInteraction scoped to the root selected by the given root matcher.
789</p>
790    <table class="responsive">
791    <tr><th colspan=2>Parameters</th></tr>
792      <tr>
793        <td><code>rootMatcher</code></td>
794        <td width="100%">
795          <code>Matcher</code>
796          <!-- no parameter comment --></td>
797      </tr>
798    </table>
799    <table class="responsive">
800      <tr><th colspan=2>Returns</th></tr>
801      <tr>
802        <td><code><a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a></code></td>
803        <td width="100%"><!-- no returns description in source --></td>
804      </tr>
805    </table>
806
807</div>
808
809
810<A NAME="perform(android.support.test.espresso.ViewAction...)"></A>
811
812<div class="api apilevel-">
813    <h3 class="api-name">perform</h3>
814    <div class="api-level">
815      <div></div>
816
817
818
819    </div>
820<pre class="api-signature no-pretty-print">
821<a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a> perform (<a href="/reference/android/support/test/espresso/ViewAction.html">ViewAction...</a> viewActions)</pre>
822
823
824
825
826  <p>Performs the given action(s) on the view selected by the current view matcher. If more than one
827 action is provided, actions are executed in the order provided with precondition checks running
828 prior to each action.</p>
829    <table class="responsive">
830    <tr><th colspan=2>Parameters</th></tr>
831      <tr>
832        <td><code>viewActions</code></td>
833        <td width="100%">
834          <code>ViewAction</code>:
835          one or more actions to execute.</td>
836      </tr>
837    </table>
838    <table class="responsive">
839      <tr><th colspan=2>Returns</th></tr>
840      <tr>
841        <td><code><a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a></code></td>
842        <td width="100%">this interaction for further perform/verification calls.
843</td>
844      </tr>
845    </table>
846
847</div>
848
849
850<A NAME="withFailureHandler(android.support.test.espresso.FailureHandler)"></A>
851
852<div class="api apilevel-">
853    <h3 class="api-name">withFailureHandler</h3>
854    <div class="api-level">
855      <div></div>
856
857
858
859    </div>
860<pre class="api-signature no-pretty-print">
861<a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a> withFailureHandler (<a href="/reference/android/support/test/espresso/FailureHandler.html">FailureHandler</a> failureHandler)</pre>
862
863
864
865
866  <p>Replaces the default failure handler (@see Espresso.setFailureHandler) with a custom
867 failurehandler for this particular interaction.</p>
868    <table class="responsive">
869    <tr><th colspan=2>Parameters</th></tr>
870      <tr>
871        <td><code>failureHandler</code></td>
872        <td width="100%">
873          <code>FailureHandler</code>:
874          a non-null failurehandler to use to report failures.</td>
875      </tr>
876    </table>
877    <table class="responsive">
878      <tr><th colspan=2>Returns</th></tr>
879      <tr>
880        <td><code><a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a></code></td>
881        <td width="100%">this interaction for further perform/verification calls.
882</td>
883      </tr>
884    </table>
885
886</div>
887
888
889
890
891
892<!-- ========= METHOD DETAIL ======== -->
893
894
895
896<!-- ========= END OF CLASS DATA ========= -->
897
898</div><!-- end jd-content -->
899
900
901
902<div class="data-reference-resources-wrapper">
903
904  <ul data-reference-resources>
905
906
907    <li><h2>Interfaces</h2>
908      <ul>
909          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/BaseLayerComponent.html">BaseLayerComponent</a></li>
910          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/EspressoException.html">EspressoException</a></li>
911          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/FailureHandler.html">FailureHandler</a></li>
912          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/IdlingResource.html">IdlingResource</a></li>
913          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/IdlingResource.ResourceCallback.html">IdlingResource.ResourceCallback</a></li>
914          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/UiController.html">UiController</a></li>
915          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/ViewAction.html">ViewAction</a></li>
916          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/ViewAssertion.html">ViewAssertion</a></li>
917          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/ViewFinder.html">ViewFinder</a></li>
918          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/ViewInteractionComponent.html">ViewInteractionComponent</a></li>
919      </ul>
920    </li>
921
922    <li><h2>Classes</h2>
923      <ul>
924          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/AmbiguousViewMatcherException.Builder.html">AmbiguousViewMatcherException.Builder</a></li>
925          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/DataInteraction.html">DataInteraction</a></li>
926          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/Espresso.html">Espresso</a></li>
927          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/GraphHolder.html">GraphHolder</a></li>
928          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/IdlingPolicies.html">IdlingPolicies</a></li>
929          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/IdlingPolicy.html">IdlingPolicy</a></li>
930          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/NoMatchingViewException.Builder.html">NoMatchingViewException.Builder</a></li>
931          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/PerformException.Builder.html">PerformException.Builder</a></li>
932          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/Root.html">Root</a></li>
933          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/Root.Builder.html">Root.Builder</a></li>
934          <li class="selected api apilevel-"><a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a></li>
935      </ul>
936    </li>
937
938
939    <li><h2>Exceptions</h2>
940      <ul>
941          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/AmbiguousViewMatcherException.html">AmbiguousViewMatcherException</a></li>
942          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/AppNotIdleException.html">AppNotIdleException</a></li>
943          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/IdlingResourceTimeoutException.html">IdlingResourceTimeoutException</a></li>
944          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/InjectEventSecurityException.html">InjectEventSecurityException</a></li>
945          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/NoActivityResumedException.html">NoActivityResumedException</a></li>
946          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/NoMatchingRootException.html">NoMatchingRootException</a></li>
947          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/NoMatchingViewException.html">NoMatchingViewException</a></li>
948          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/PerformException.html">PerformException</a></li>
949      </ul>
950    </li>
951
952  </ul>
953
954</div>
955
956
957
958</body>
959</html>
960