File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/main/java/io/appium/java_client/pagefactory Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ Here are some ways you could configure a UiSelector in your project:
101
101
// Create a selector that looks for the text "Hello World":
102
102
@AndroidFindBy (uiAutomator = " new UiSelector().text(\" Hello World\" )" )
103
103
104
+ // Create a selector that tries to find an ImageView:
105
+ @AndroidFindBy (uiAutomator = " new UiSelector().className(\" android.widget.ImageView\" )" )
106
+
104
107
// Create a selector that matches resource ids against a regular expression:
105
108
private static final String looksLikeAPage = " page_number_\d *" ;
106
109
@AndroidFindBy (uiAutomator = " new UiSelector().resourceIdMatches(\" " + looksLikeAPage + " \" )" )
@@ -118,5 +121,13 @@ private static final String looksLikeAPage = "page_number_\d*";
118
121
..and here are some that create UiScrollable objects:
119
122
120
123
``` java
121
- // TODO: Provide samples
124
+ private static final String ourImageSelector = " .className(\" android.widget.ImageView\" )" ;
125
+ private static final String ourListSelector = " .className(\" android.widget.ListView\" )" ;
126
+
127
+ // Create a scrollable associated with a list (by itself, this doesn't do anything useful...)
128
+ @AndroidFindBy (uiAutomator = " new UiScrollable(" + ourListSelector + " )" )
129
+
130
+ // Create a scrollable that scrolls forward along a list until it finds an ImageView:
131
+ @AndroidFindBy (uiAutomator = " new UiScrollable(" + ourListSelector + " ).scrollIntoView(" + ourImageSelector + " )" )
132
+
122
133
```
You can’t perform that action at this time.
0 commit comments