diff --git a/hrp/step_android_ui.go b/hrp/step_android_ui.go index fb2856b5..4db318e7 100644 --- a/hrp/step_android_ui.go +++ b/hrp/step_android_ui.go @@ -4,9 +4,9 @@ import ( "fmt" "time" - "github.com/rs/zerolog/log" - "github.com/httprunner/httprunner/v4/hrp/internal/uixt" + "github.com/pkg/errors" + "github.com/rs/zerolog/log" ) var ( @@ -466,6 +466,13 @@ func runStepAndroid(s *SessionRunner, step *TStep) (stepResult *StepResult, err } screenshots := make([]string, 0) + // override step variables + stepVariables, err := s.MergeStepVariables(step.Variables) + if err != nil { + return + } + parser := s.GetParser() + // init uiaClient driver uiaClient, err := s.hrpRunner.initUIClient(&step.Android.AndroidDevice) if err != nil { @@ -511,6 +518,9 @@ func runStepAndroid(s *SessionRunner, step *TStep) (stepResult *StepResult, err // run actions for _, action := range actions { + if action.Params, err = parser.Parse(action.Params, stepVariables); err != nil { + return stepResult, errors.Wrap(err, "parse action params failed") + } if err := uiaClient.DoAction(action); err != nil { return stepResult, err }