@@ -251,17 +251,23 @@ func (a *ControlInterface) TurnOff() {
251251 a .deviceInspectorShowVisuals (false )
252252}
253253
254- // Move navigates focus using the given direction and returns selected element data .
255- func ( a * ControlInterface ) Move ( ctx context. Context , direction MoveDirection ) ( AXElementData , error ) {
256- log . Info ( "changing" )
254+ // Move sends the move command without waiting for response .
255+ // Use AwaitElementChanged to get the response asynchronously.
256+ func ( a * ControlInterface ) Move ( direction MoveDirection ) {
257257 a .deviceInspectorMoveWithOptions (direction )
258- log . Info ( "before changed" )
258+ }
259259
260+ // AwaitElementChanged waits for timeout if available
261+ // returns the next element change response.
262+ func (a * ControlInterface ) AwaitElementChanged (ctx context.Context ) (AXElementData , error ) {
260263 resp , err := a .awaitHostInspectorCurrentElementChanged (ctx )
261264 if err != nil {
262265 return AXElementData {}, err
263266 }
267+ return a .parseElementResponse (resp )
268+ }
264269
270+ func (a * ControlInterface ) parseElementResponse (resp map [string ]interface {}) (AXElementData , error ) {
265271 innerValue , err := getInnerValue (resp )
266272 if err != nil {
267273 return AXElementData {}, err
@@ -469,7 +475,8 @@ func (a *ControlInterface) PerformAction(actionName Action, currentPlatformEleme
469475
470476// GetElement moves the green selection rectangle one element further
471477func (a * ControlInterface ) GetElement (ctx context.Context ) (AXElementData , error ) {
472- return a .Move (ctx , DirectionNext )
478+ a .Move (DirectionNext )
479+ return a .AwaitElementChanged (ctx )
473480}
474481
475482func (a * ControlInterface ) UpdateAccessibilitySetting (name string , val interface {}) {
0 commit comments