|
26 | 26 |
|
27 | 27 | import java.io.Serializable;
|
28 | 28 | import java.util.List;
|
| 29 | +import java.util.Map; |
| 30 | +import java.util.Collections; |
| 31 | +import java.util.HashMap; |
29 | 32 |
|
30 | 33 | import static com.google.common.base.Strings.isNullOrEmpty;
|
31 | 34 |
|
@@ -53,6 +56,13 @@ protected AppiumBy(String selector, String locatorString, String locatorName) {
|
53 | 56 | return String.format("%s.%s: %s", AppiumBy.class.getSimpleName(), locatorName, remoteParameters.value());
|
54 | 57 | }
|
55 | 58 |
|
| 59 | + public Map<String, Object> toJson() { |
| 60 | + Map<String, Object> params = new HashMap<String, Object>(); |
| 61 | + params.put("using", this.remoteParameters.using()); |
| 62 | + params.put("value", this.remoteParameters.value()); |
| 63 | + return Collections.unmodifiableMap(params); |
| 64 | + } |
| 65 | + |
56 | 66 | /**
|
57 | 67 | * About Android accessibility
|
58 | 68 | * https://developer.android.com/intl/ru/training/accessibility/accessible-app.html
|
@@ -186,6 +196,51 @@ public static By iOSNsPredicateString(final String iOSNsPredicateString) {
|
186 | 196 | return new ByIosNsPredicate(iOSNsPredicateString);
|
187 | 197 | }
|
188 | 198 |
|
| 199 | + /** |
| 200 | + * This locator strategy is available in FlutterIntegration Driver mode. |
| 201 | + * @param selector is the value defined to the key attribute of the flutter element |
| 202 | + * @return an instance of {@link AppiumBy.ByFlutterKey} |
| 203 | + */ |
| 204 | + public static By flutterKey(final String selector) { |
| 205 | + return new ByFlutterKey(selector); |
| 206 | + } |
| 207 | + |
| 208 | + /** |
| 209 | + * This locator strategy is available in FlutterIntegration Driver mode. |
| 210 | + * @param selector is the Type of widget mounted in the app tree |
| 211 | + * @return an instance of {@link AppiumBy.ByFlutterType} |
| 212 | + */ |
| 213 | + public static By flutterType(final String selector) { |
| 214 | + return new ByFlutterType(selector); |
| 215 | + } |
| 216 | + |
| 217 | + /** |
| 218 | + * This locator strategy is available in FlutterIntegration Driver mode. |
| 219 | + * @param selector is the text that is present on the widget |
| 220 | + * @return an instance of {@link AppiumBy.ByFlutterText} |
| 221 | + */ |
| 222 | + public static By flutterText(final String selector) { |
| 223 | + return new ByFlutterText(selector); |
| 224 | + } |
| 225 | + |
| 226 | + /** |
| 227 | + * This locator strategy is available in FlutterIntegration Driver mode. |
| 228 | + * @param selector is the text that is partially present on the widget |
| 229 | + * @return an instance of {@link AppiumBy.ByFlutterTextContaining} |
| 230 | + */ |
| 231 | + public static By flutterTextContaining(final String selector) { |
| 232 | + return new ByFlutterTextContaining(selector); |
| 233 | + } |
| 234 | + |
| 235 | + /** |
| 236 | + * This locator strategy is available in FlutterIntegration Driver mode. |
| 237 | + * @param semanticsLabel represents the value assigned to the label attribute of semantics element |
| 238 | + * @return an instance of {@link AppiumBy.ByFlutterSemanticsLabel} |
| 239 | + */ |
| 240 | + public static By flutterSemanticsLabel(final String semanticsLabel) { |
| 241 | + return new ByFlutterSemanticsLabel(semanticsLabel); |
| 242 | + } |
| 243 | + |
189 | 244 | public static class ByAccessibilityId extends AppiumBy implements Serializable {
|
190 | 245 | public ByAccessibilityId(String accessibilityId) {
|
191 | 246 | super("accessibility id", accessibilityId, "accessibilityId");
|
@@ -257,4 +312,34 @@ protected ByIosNsPredicate(String locatorString) {
|
257 | 312 | super("-ios predicate string", locatorString, "iOSNsPredicate");
|
258 | 313 | }
|
259 | 314 | }
|
| 315 | + |
| 316 | + public static class ByFlutterType extends AppiumBy implements Serializable { |
| 317 | + protected ByFlutterType(String locatorString) { |
| 318 | + super("-flutter type", locatorString, "flutterType"); |
| 319 | + } |
| 320 | + } |
| 321 | + |
| 322 | + public static class ByFlutterKey extends AppiumBy implements Serializable { |
| 323 | + protected ByFlutterKey(String locatorString) { |
| 324 | + super("-flutter key", locatorString, "flutterKey"); |
| 325 | + } |
| 326 | + } |
| 327 | + |
| 328 | + public static class ByFlutterSemanticsLabel extends AppiumBy implements Serializable { |
| 329 | + protected ByFlutterSemanticsLabel(String locatorString) { |
| 330 | + super("-flutter semantics label", locatorString, "flutterSemanticsLabel"); |
| 331 | + } |
| 332 | + } |
| 333 | + |
| 334 | + public static class ByFlutterText extends AppiumBy implements Serializable { |
| 335 | + protected ByFlutterText(String locatorString) { |
| 336 | + super("-flutter text", locatorString, "flutterText"); |
| 337 | + } |
| 338 | + } |
| 339 | + |
| 340 | + public static class ByFlutterTextContaining extends AppiumBy implements Serializable { |
| 341 | + protected ByFlutterTextContaining(String locatorString) { |
| 342 | + super("-flutter text containing", locatorString, "flutterTextContaining"); |
| 343 | + } |
| 344 | + } |
260 | 345 | }
|
0 commit comments