fix: adb double tap

This commit is contained in:
lilong.129
2025-06-24 22:54:26 +08:00
parent 43d990f863
commit 72a0915b04
2 changed files with 4 additions and 8 deletions

View File

@@ -1 +1 @@
v5.0.0-beta-2506242222
v5.0.0-beta-2506242254

View File

@@ -339,15 +339,11 @@ func (ad *ADBDriver) DoubleTap(x, y float64, opts ...option.ActionOption) error
xStr := fmt.Sprintf("%.1f", x)
yStr := fmt.Sprintf("%.1f", y)
_, err = ad.runShellCommand(
"input", "tap", xStr, yStr, ";",
"sleep", "0.05", ";",
"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.runShellCommand(
"input", "tap", xStr, yStr)
if err != nil {
return errors.Wrap(err, fmt.Sprintf("tap <%s, %s> failed", xStr, yStr))
return errors.Wrap(err, fmt.Sprintf("double tap <%s, %s> failed", xStr, yStr))
}
return nil
}