From 7ca12a0dbc1393de7e507f0e65689c450d2119a3 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Wed, 27 Jul 2022 12:07:21 +0800 Subject: [PATCH] feat: click on coordinate --- hrp/step_ios_ui.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hrp/step_ios_ui.go b/hrp/step_ios_ui.go index a414896f..5e744294 100644 --- a/hrp/step_ios_ui.go +++ b/hrp/step_ios_ui.go @@ -307,8 +307,18 @@ func (w *wdaClient) doAction(action MobileAction) error { // TODO return errActionNotImplemented case uiClick: - // TODO - return errActionNotImplemented + // click on coordinate + if location, ok := action.Params.([]int); ok { + if len(location) != 2 { + return fmt.Errorf("invalid click location params: %v", location) + } + return w.Driver.Tap(location[0], location[1]) + } + // click on xpath + if _, ok := action.Params.(string); ok { + return errActionNotImplemented + } + return fmt.Errorf("invalid click params: %v", action.Params) case uiDoubleClick: // TODO return errActionNotImplemented