29
29
30
30
public abstract class AppiumBy extends By implements Remotable {
31
31
32
- @ Getter
33
- private final Parameters remoteParameters ;
32
+ @ Getter private final Parameters remoteParameters ;
34
33
private final String locatorName ;
35
34
36
35
protected AppiumBy (String selector , String locatorString , String locatorName ) {
@@ -39,28 +38,24 @@ protected AppiumBy(String selector, String locatorString, String locatorName) {
39
38
this .locatorName = locatorName ;
40
39
}
41
40
42
- @ Override
43
- public List <WebElement > findElements (SearchContext context ) {
41
+ @ Override public List <WebElement > findElements (SearchContext context ) {
44
42
return context .findElements (this );
45
43
}
46
44
47
- @ Override
48
- public WebElement findElement (SearchContext context ) {
45
+ @ Override public WebElement findElement (SearchContext context ) {
49
46
return context .findElement (this );
50
47
}
51
48
52
- @ Override
53
- public String toString () {
49
+ @ Override public String toString () {
54
50
return String .format ("%s.%s: %s" , AppiumBy .class .getSimpleName (), locatorName , remoteParameters .value ());
55
51
}
56
52
57
53
/**
58
54
* About Android accessibility
59
- * <a href=" https://developer.android.com/intl/ru/training/accessibility/accessible-app.html">https://developer.android.com/intl/ru/training/accessibility/accessible-app.html</a>
55
+ * https://developer.android.com/intl/ru/training/accessibility/accessible-app.html
60
56
* About iOS accessibility
61
- * <a href=" https://developer.apple.com/library/ios/documentation/UIKit/Reference/">https://developer.apple.com/library/ios/documentation/UIKit/Reference/</a>
57
+ * https://developer.apple.com/library/ios/documentation/UIKit/Reference/
62
58
* UIAccessibilityIdentification_Protocol/index.html
63
- *
64
59
* @param accessibilityId id is a convenient UI automation accessibility Id.
65
60
* @return an instance of {@link AppiumBy.ByAndroidUIAutomator}
66
61
*/
@@ -70,19 +65,17 @@ public static By accessibilityId(final String accessibilityId) {
70
65
71
66
/**
72
67
* This locator strategy is only available in Espresso Driver mode.
73
- *
74
68
* @param dataMatcherString is a valid json string detailing hamcrest matcher for Espresso onData().
75
- * See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
76
- * the documentation</a> for more details.
69
+ * See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
70
+ * the documentation</a> for more details
77
71
* @return an instance of {@link AppiumBy.ByAndroidDataMatcher}
78
72
*/
79
73
public static By androidDataMatcher (final String dataMatcherString ) {
80
74
return new ByAndroidDataMatcher (dataMatcherString );
81
75
}
82
76
83
77
/**
84
- * Refer to <a href="https://developer.android.com/training/testing/ui-automator">https://developer.android.com/training/testing/ui-automator</a>
85
- *
78
+ * Refer to https://developer.android.com/training/testing/ui-automator
86
79
* @param uiautomatorText is Android UIAutomator string
87
80
* @return an instance of {@link AppiumBy.ByAndroidUIAutomator}
88
81
*/
@@ -92,10 +85,9 @@ public static By androidUIAutomator(final String uiautomatorText) {
92
85
93
86
/**
94
87
* This locator strategy is only available in Espresso Driver mode.
95
- *
96
88
* @param viewMatcherString is a valid json string detailing hamcrest matcher for Espresso onView().
97
- * See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
98
- * the documentation</a> for more details
89
+ * See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
90
+ * the documentation</a> for more details
99
91
* @return an instance of {@link AppiumBy.ByAndroidViewMatcher}
100
92
*/
101
93
public static By androidViewMatcher (final String viewMatcherString ) {
@@ -104,10 +96,9 @@ public static By androidViewMatcher(final String viewMatcherString) {
104
96
105
97
/**
106
98
* This locator strategy is available in Espresso Driver mode.
107
- *
99
+ * @since Appium 1.8.2 beta
108
100
* @param tag is a view tag string
109
101
* @return an instance of {@link ByAndroidViewTag}
110
- * @since Appium 1.8.2 beta
111
102
*/
112
103
public static By androidViewTag (final String tag ) {
113
104
return new ByAndroidViewTag (tag );
@@ -116,7 +107,6 @@ public static By androidViewTag(final String tag) {
116
107
/**
117
108
* For IOS it is the full name of the XCUI element and begins with XCUIElementType.
118
109
* For Android it is the full name of the UIAutomator2 class (e.g.: android.widget.TextView)
119
- *
120
110
* @param selector the class name of the element
121
111
* @return an instance of {@link ByClassName}
122
112
*/
@@ -127,7 +117,6 @@ public static By className(final String selector) {
127
117
/**
128
118
* For IOS the element name.
129
119
* For Android it is the resource identifier.
130
- *
131
120
* @param selector element id
132
121
* @return an instance of {@link ById}
133
122
*/
@@ -138,7 +127,6 @@ public static By id(final String selector) {
138
127
/**
139
128
* For IOS the element name.
140
129
* For Android it is the resource identifier.
141
- *
142
130
* @param selector element id
143
131
* @return an instance of {@link ByName}
144
132
*/
@@ -162,25 +150,24 @@ public static By custom(final String selector) {
162
150
* This locator strategy is available only if OpenCV libraries and
163
151
* Node.js bindings are installed on the server machine.
164
152
*
165
- * @param b64Template base64-encoded template image string. Supported image formats are the same
166
- * as for OpenCV library.
167
- * @return an instance of {@link ByImage}
168
153
* @see <a href="https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md">
169
- * The documentation on Image Comparison Features</a>.
154
+ * The documentation on Image Comparison Features</a>
170
155
* @see <a href="https://github.com/appium/appium-base-driver/blob/master/lib/basedriver/device-settings.js">
171
- * The settings available for lookup fine-tuning</a>.
156
+ * The settings available for lookup fine-tuning</a>
172
157
* @since Appium 1.8.2
158
+ * @param b64Template base64-encoded template image string. Supported image formats are the same
159
+ * as for OpenCV library.
160
+ * @return an instance of {@link ByImage}
173
161
*/
174
162
public static By image (final String b64Template ) {
175
163
return new ByImage (b64Template );
176
164
}
177
165
178
166
/**
179
167
* This locator strategy is available in XCUITest Driver mode.
180
- *
181
- * @param iOSClassChainString is a valid class chain locator string
168
+ * @param iOSClassChainString is a valid class chain locator string.
182
169
* See <a href="https://github.com/facebookarchive/WebDriverAgent/wiki/Class-Chain-Queries-Construction-Rules">
183
- * the documentation</a> for more details.
170
+ * the documentation</a> for more details
184
171
* @return an instance of {@link AppiumBy.ByIosClassChain}
185
172
*/
186
173
public static By iOSClassChain (final String iOSClassChainString ) {
@@ -189,7 +176,6 @@ public static By iOSClassChain(final String iOSClassChainString) {
189
176
190
177
/**
191
178
* This locator strategy is available in XCUITest Driver mode.
192
- *
193
179
* @param iOSNsPredicateString is an iOS NsPredicate String
194
180
* @return an instance of {@link AppiumBy.ByIosNsPredicate}
195
181
*/
@@ -259,8 +245,7 @@ protected ByImage(String b64Template) {
259
245
260
246
public static class ByIosClassChain extends AppiumBy implements Serializable {
261
247
protected ByIosClassChain (String locatorString ) {
262
- super ("-ios class chain" , locatorString ,
263
- "iOSClassChain" );
248
+ super ("-ios class chain" , locatorString , "iOSClassChain" );
264
249
}
265
250
}
266
251
0 commit comments