Skip to content
Navigation Menu
{{ message }}
forked from appium/java-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMobileBy.java
More file actions
340 lines (295 loc) · 12.3 KB
/
Copy pathMobileBy.java
File metadata and controls
340 lines (295 loc) · 12.3 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.appium.java_client;
import java.io.Serializable;
import org.openqa.selenium.By;
/**
* Appium locating strategies.
*
* @deprecated Use {@link AppiumBy} instead.
*/
@SuppressWarnings("serial")
@Deprecated
public abstract class MobileBy extends AppiumBy {
protected MobileBy(String selector, String locatorString, String locatorName) {
super(selector, locatorString, locatorName);
}
/**
* Refer to https://developer.android.com/training/testing/ui-automator
* @deprecated Use {@link AppiumBy#androidUIAutomator(String)} instead.
* @param uiautomatorText is Android UIAutomator string
* @return an instance of {@link ByAndroidUIAutomator}
*/
@Deprecated
public static By AndroidUIAutomator(final String uiautomatorText) {
return new ByAndroidUIAutomator(uiautomatorText);
}
/**
* About Android accessibility
* https://developer.android.com/intl/ru/training/accessibility/accessible-app.html
* About iOS accessibility
* https://developer.apple.com/library/ios/documentation/UIKit/Reference/
* UIAccessibilityIdentification_Protocol/index.html
* @deprecated Use {@link AppiumBy#accessibilityId(String)} instead.
* @param accessibilityId id is a convenient UI automation accessibility Id.
* @return an instance of {@link ByAndroidUIAutomator}
*/
@Deprecated
public static By AccessibilityId(final String accessibilityId) {
return new ByAccessibilityId(accessibilityId);
}
/**
* This locator strategy is available in XCUITest Driver mode.
* @deprecated Use {@link AppiumBy#iOSClassChain(String)} instead.
* @param iOSClassChainString is a valid class chain locator string.
* See <a href="https://github.com/facebookarchive/WebDriverAgent/wiki/Class-Chain-Queries-Construction-Rules">
* the documentation</a> for more details
* @return an instance of {@link ByIosClassChain}
*/
@Deprecated
public static By iOSClassChain(final String iOSClassChainString) {
return new ByIosClassChain(iOSClassChainString);
}
/**
* This locator strategy is only available in Espresso Driver mode.
* @deprecated Use {@link AppiumBy#androidDataMatcher(String)} instead.
* @param dataMatcherString is a valid json string detailing hamcrest matcher for Espresso onData().
* See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
* the documentation</a> for more details
* @return an instance of {@link ByAndroidDataMatcher}
*/
@Deprecated
public static By androidDataMatcher(final String dataMatcherString) {
return new ByAndroidDataMatcher(dataMatcherString);
}
/**
* This locator strategy is only available in Espresso Driver mode.
* @deprecated Use {@link AppiumBy#androidViewMatcher(String)} instead.
* @param viewMatcherString is a valid json string detailing hamcrest matcher for Espresso onView().
* See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
* the documentation</a> for more details
* @return an instance of {@link ByAndroidViewMatcher}
*/
@Deprecated
public static By androidViewMatcher(final String viewMatcherString) {
return new ByAndroidViewMatcher(viewMatcherString);
}
/**
* This locator strategy is available in XCUITest Driver mode.
* @deprecated Use {@link AppiumBy#iOSNsPredicateString(String)} instead.
* @param iOSNsPredicateString is an iOS NsPredicate String
* @return an instance of {@link ByIosNsPredicate}
*/
@Deprecated
public static By iOSNsPredicateString(final String iOSNsPredicateString) {
return new ByIosNsPredicate(iOSNsPredicateString);
}
/**
* The Windows UIAutomation selector.
* @deprecated Not supported on the server side.
* @param windowsAutomation The element name in the Windows UIAutomation selector
* @return an instance of {@link MobileBy.ByWindowsAutomation}
*/
@Deprecated
public static By windowsAutomation(final String windowsAutomation) {
return new ByWindowsAutomation(windowsAutomation);
}
/**
* This locator strategy is available in Espresso Driver mode.
* @deprecated Use {@link AppiumBy#androidViewTag(String)} instead.
* @since Appium 1.8.2 beta
* @param tag is an view tag string
* @return an instance of {@link ByAndroidViewTag}
*/
@Deprecated
public static By AndroidViewTag(final String tag) {
return new ByAndroidViewTag(tag);
}
/**
* This locator strategy is available only if OpenCV libraries and
* NodeJS bindings are installed on the server machine.
*
* @deprecated Use {@link AppiumBy#image(String)} instead.
* @see <a href="https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md">
* The documentation on Image Comparison Features</a>
* @see <a href="https://github.com/appium/appium-base-driver/blob/master/lib/basedriver/device-settings.js">
* The settings available for lookup fine-tuning</a>
* @since Appium 1.8.2
* @param b64Template base64-encoded template image string. Supported image formats are the same
* as for OpenCV library.
* @return an instance of {@link ByImage}
*/
@Deprecated
public static By image(final String b64Template) {
return new ByImage(b64Template);
}
/**
* This type of locator requires the use of the 'customFindModules' capability and a
* separately-installed element finding plugin.
*
* @deprecated Use {@link AppiumBy#custom(String)} instead.
* @param selector selector to pass to the custom element finding plugin
* @return an instance of {@link ByCustom}
* @since Appium 1.9.2
*/
@Deprecated
public static By custom(final String selector) {
return new ByCustom(selector);
}
/**
* Refer to https://developer.android.com/training/testing/ui-automator
*
* @deprecated Use {@link AppiumBy.ByAndroidUIAutomator} instead.
*/
@Deprecated
public static class ByAndroidUIAutomator extends AppiumBy.ByAndroidUIAutomator {
public ByAndroidUIAutomator(String uiautomatorText) {
super(uiautomatorText);
}
@Override public String toString() {
return "By.AndroidUIAutomator: " + getRemoteParameters().value();
}
}
/**
* About Android accessibility
* https://developer.android.com/intl/ru/training/accessibility/accessible-app.html
* About iOS accessibility
* https://developer.apple.com/library/ios/documentation/UIKit/Reference/
* UIAccessibilityIdentification_Protocol/index.html
* @deprecated Use {@link AppiumBy.ByAccessibilityId} instead.
*/
@Deprecated
public static class ByAccessibilityId extends AppiumBy.ByAccessibilityId {
public ByAccessibilityId(String accessibilityId) {
super(accessibilityId);
}
@Override public String toString() {
return "By.AccessibilityId: " + getRemoteParameters().value();
}
}
/**
* This locator strategy is available in XCUITest Driver mode.
* See <a href="https://github.com/facebookarchive/WebDriverAgent/wiki/Class-Chain-Queries-Construction-Rules">
* the documentation</a> for more details
* @deprecated Use {@link AppiumBy.ByIosClassChain} instead.
*/
@Deprecated
public static class ByIosClassChain extends AppiumBy.ByIosClassChain {
protected ByIosClassChain(String locatorString) {
super(locatorString);
}
@Override public String toString() {
return "By.IosClassChain: " + getRemoteParameters().value();
}
}
/**
* This locator strategy is only available in Espresso Driver mode.
* See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
* the documentation</a> for more details
* @deprecated Use {@link AppiumBy.ByAndroidDataMatcher} instead.
*/
@Deprecated
public static class ByAndroidDataMatcher extends AppiumBy.ByAndroidDataMatcher {
protected ByAndroidDataMatcher(String locatorString) {
super(locatorString);
}
@Override public String toString() {
return "By.AndroidDataMatcher: " + getRemoteParameters().value();
}
}
/**
* This locator strategy is only available in Espresso Driver mode.
* See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
* the documentation</a> for more details
* @deprecated Use {@link AppiumBy.ByAndroidViewMatcher} instead.
*/
@Deprecated
public static class ByAndroidViewMatcher extends AppiumBy.ByAndroidViewMatcher {
protected ByAndroidViewMatcher(String locatorString) {
super(locatorString);
}
@Override public String toString() {
return "By.AndroidViewMatcher: " + getRemoteParameters().value();
}
}
/**
* This locator strategy is available in XCUITest Driver mode.
* @deprecated Use {@link AppiumBy.ByIosNsPredicate} instead.
*/
@Deprecated
public static class ByIosNsPredicate extends AppiumBy.ByIosNsPredicate {
protected ByIosNsPredicate(String locatorString) {
super(locatorString);
}
@Override public String toString() {
return "By.IosNsPredicate: " + getRemoteParameters().value();
}
}
/**
* The Windows UIAutomation selector.
* @deprecated Not supported on the server side.
*/
@Deprecated
public static class ByWindowsAutomation extends MobileBy implements Serializable {
protected ByWindowsAutomation(String locatorString) {
super("-windows uiautomation", locatorString, "windowsAutomation");
}
@Override public String toString() {
return "By.windowsAutomation: " + getRemoteParameters().value();
}
}
/**
* This locator strategy is available only if OpenCV libraries and
* NodeJS bindings are installed on the server machine.
* @deprecated Use {@link AppiumBy.ByImage} instead.
*/
@Deprecated
public static class ByImage extends AppiumBy.ByImage {
protected ByImage(String b64Template) {
super(b64Template);
}
@Override public String toString() {
return "By.Image: " + getRemoteParameters().value();
}
}
/**
* This type of locator requires the use of the 'customFindModules' capability and a
* separately-installed element finding plugin.
* @deprecated Use {@link AppiumBy.ByCustom} instead.
*/
@Deprecated
public static class ByCustom extends AppiumBy.ByCustom {
protected ByCustom(String selector) {
super(selector);
}
@Override public String toString() {
return "By.Custom: " + getRemoteParameters().value();
}
}
/**
* This locator strategy is available in Espresso Driver mode.
* @deprecated Use {@link AppiumBy.ByAndroidViewTag} instead.
*/
@Deprecated
public static class ByAndroidViewTag extends AppiumBy.ByAndroidViewTag {
public ByAndroidViewTag(String tag) {
super(tag);
}
@Override public String toString() {
return "By.AndroidViewTag: " + getRemoteParameters().value();
}
}
}
You can’t perform that action at this time.
