update: android actions

This commit is contained in:
xucong053
2022-09-29 16:20:53 +08:00
parent 7bad3a99d1
commit 29acab1b06

View File

@@ -112,6 +112,32 @@ func (s *StepAndroid) StopRecording() *StepAndroid {
return &StepAndroid{step: s.step}
}
// TapXY taps the point {X,Y}, X & Y is percentage of coordinates
func (s *StepAndroid) TapXY(x, y float64, options ...uixt.ActionOption) *StepAndroid {
action := uixt.MobileAction{
Method: uixt.ACTION_TapXY,
Params: []float64{x, y},
}
for _, option := range options {
option(&action)
}
s.step.Android.Actions = append(s.step.Android.Actions, action)
return &StepAndroid{step: s.step}
}
// TapAbsXY taps the point {X,Y}, X & Y is absolute coordinates
func (s *StepAndroid) TapAbsXY(x, y float64, options ...uixt.ActionOption) *StepAndroid {
action := uixt.MobileAction{
Method: uixt.ACTION_TapAbsXY,
Params: []float64{x, y},
}
for _, option := range options {
option(&action)
}
s.step.Android.Actions = append(s.step.Android.Actions, action)
return &StepAndroid{step: s.step}
}
func (s *StepAndroid) Tap(params interface{}) *StepAndroid {
s.step.Android.Actions = append(s.step.Android.Actions, uixt.MobileAction{
Method: uixt.ACTION_Tap,