File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -27,11 +27,22 @@ export async function findElOrEls(
2727 const isFlutterLocator =
2828 strategy . startsWith ( '-flutter' ) || FLUTTER_LOCATORS . includes ( strategy ) ;
2929
30- const parsedSelector =
31- [ '-flutter descendant' , '-flutter ancestor' ] . includes ( strategy ) &&
32- _ . isString ( selector )
33- ? JSON . parse ( selector )
34- : selector ; // Special case
30+ let parsedSelector ;
31+ if ( [ '-flutter descendant' , '-flutter ancestor' ] . includes ( strategy ) ) {
32+ // Handle descendant/ancestor special case
33+ parsedSelector = _ . isString ( selector ) ? JSON . parse ( selector ) : selector ;
34+
35+ // For Mac2Driver and XCUITestDriver, format selector differently
36+ if ( proxyDriver instanceof XCUITestDriver || proxyDriver instanceof Mac2Driver ) {
37+ return {
38+ using : strategy ,
39+ value : JSON . stringify ( parsedSelector ) ,
40+ context
41+ } ;
42+ }
43+ } else {
44+ parsedSelector = selector ;
45+ }
3546
3647 // If user is looking for Native IOS/Mac locator
3748 if (
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ describe('Element Interaction Functions', () => {
7070
7171 expect ( result ) . to . deep . equal ( element ) ;
7272 expect ( ELEMENT_CACHE . get ( 'elem1' ) ) . to . equal ( mockDriver ) ;
73+ // Since proxydriver is not Mac2Driver, XCUITestDriver, or AndroidUiautomator2Driver
7374 expect (
7475 mockDriver . command . calledWith ( '/element' , 'POST' , {
7576 strategy : 'strategy' ,
You can’t perform that action at this time.
0 commit comments