@@ -137,11 +137,11 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
137137 required : [ 'imageId' ] ,
138138 } ,
139139 } ,
140- 'flutter: getRenderTreeByType ' : {
141- command : 'getRenderTreeByType ' ,
140+ 'flutter: getRenderTree ' : {
141+ command : 'getRenderTree ' ,
142142 params : {
143- required : [ 'widgetType' ] ,
144- optional : [ 'text' , 'key' ] ,
143+ required : [ ] ,
144+ optional : [ 'widgetType' , ' text', 'key' ] ,
145145 } ,
146146 } ,
147147 } ;
@@ -438,14 +438,23 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
438438 return activateAppResponse ;
439439 }
440440
441- async getRenderTreeByType ( widgetType : string , text ?: string , key ?: string ) {
442- const query = new URLSearchParams ( { widgetType } ) ;
443- if ( text ) query . append ( 'text' , text ) ;
444- if ( key ) query . append ( 'key' , key ) ;
441+ async getRenderTree ( widgetType ?: string , text ?: string , key ?: string ) {
442+ const query = new URLSearchParams ( ) ;
445443
446- return this . proxy ?. command (
447- `/session/${ this . sessionId } /element/render_tree?${ query . toString ( ) } ` ,
448- 'GET'
449- ) ;
444+ if ( widgetType ) {
445+ query . append ( 'widgetType' , widgetType ) ;
446+ }
447+ if ( text ) {
448+ query . append ( 'text' , text ) ;
449+ }
450+ if ( key ) {
451+ query . append ( 'key' , key ) ;
452+ }
453+
454+ const queryString = query . toString ( ) ;
455+ const url = queryString
456+ ? `/session/${ this . sessionId } /element/render_tree?${ queryString } `
457+ : `/session/${ this . sessionId } /element/render_tree` ;
458+ return this . proxy ?. command ( url , 'GET' ) ;
450459 }
451460}
0 commit comments