File tree Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,15 @@ import type { AppiumFlutterDriver } from '../driver';
1111
1212export const ELEMENT_CACHE = new Map ( ) ;
1313
14- function constructFindElementPayload (
14+ export function constructFindElementPayload (
1515 strategy : string ,
1616 selector : string ,
17- context : string ,
18- proxyDriver : XCUITestDriver | AndroidUiautomator2Driver | Mac2Driver ,
17+ context ?: any ,
18+ proxyDriver ? : XCUITestDriver | AndroidUiautomator2Driver | Mac2Driver ,
1919) {
20+ if ( ! strategy || ! selector ) {
21+ return undefined ;
22+ }
2023 const isFlutterLocator =
2124 strategy . startsWith ( '-flutter' ) || FLUTTER_LOCATORS . includes ( strategy ) ;
2225
@@ -31,6 +34,7 @@ function constructFindElementPayload(
3134 // If user is looking for Native IOS/Mac locator
3235 if (
3336 ! isFlutterLocator &&
37+ proxyDriver &&
3438 ( proxyDriver instanceof XCUITestDriver ||
3539 proxyDriver instanceof Mac2Driver )
3640 ) {
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import {
2424 clear ,
2525 ELEMENT_CACHE ,
2626 getElementRect ,
27+ constructFindElementPayload ,
2728} from './commands/element' ;
2829import {
2930 attachAppLaunchArguments ,
@@ -362,7 +363,10 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
362363 'POST' ,
363364 {
364365 element,
365- locator,
366+ locator : constructFindElementPayload (
367+ locator ?. using ,
368+ locator ?. value ,
369+ ) ,
366370 timeout,
367371 } ,
368372 ) ;
@@ -378,7 +382,10 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
378382 'POST' ,
379383 {
380384 element,
381- locator,
385+ locator : constructFindElementPayload (
386+ locator ?. using ,
387+ locator ?. value ,
388+ ) ,
382389 timeout,
383390 } ,
384391 ) ;
@@ -391,7 +398,10 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
391398 {
392399 origin,
393400 offset,
394- locator,
401+ locator : constructFindElementPayload (
402+ locator ?. using ,
403+ locator ?. value ,
404+ ) ,
395405 } ,
396406 ) ;
397407 }
@@ -420,7 +430,10 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
420430 `/session/:sessionId/appium/gestures/scroll_till_visible` ,
421431 'POST' ,
422432 {
423- finder,
433+ finder : constructFindElementPayload (
434+ finder . using || finder . strategy ,
435+ finder . value || finder . selector ,
436+ ) ,
424437 scrollView,
425438 delta,
426439 maxScrolls,
You can’t perform that action at this time.
0 commit comments