feat: android double tap

This commit is contained in:
cooscao
2024-08-29 15:38:06 +08:00
parent 5856652b30
commit 648cc2dcb0
4 changed files with 44 additions and 8 deletions
+15 -2
View File
@@ -295,8 +295,21 @@ func (ad *adbDriver) DoubleTap(x, y int) error {
}
func (ad *adbDriver) DoubleTapFloat(x, y float64) (err error) {
err = errDriverNotImplemented
return
// adb shell input tap x y
xStr := fmt.Sprintf("%.1f", x)
yStr := fmt.Sprintf("%.1f", y)
_, err = ad.adbClient.RunShellCommand(
"input", "tap", xStr, yStr)
if err != nil {
return errors.Wrap(err, fmt.Sprintf("tap <%s, %s> failed", xStr, yStr))
}
time.Sleep(time.Duration(100) * time.Millisecond)
_, err = ad.adbClient.RunShellCommand(
"input", "tap", xStr, yStr)
if err != nil {
return errors.Wrap(err, fmt.Sprintf("tap <%s, %s> failed", xStr, yStr))
}
return nil
}
func (ad *adbDriver) TouchAndHold(x, y int, second ...float64) (err error) {