change: FindScreenText return text rect

This commit is contained in:
lilong.129
2025-03-17 15:09:04 +08:00
parent 3e7e9b0ef9
commit 7f69052be6
5 changed files with 15 additions and 15 deletions
+2 -1
View File
@@ -12,13 +12,14 @@ func (dExt *XTDriver) TapByOCR(text string, opts ...option.ActionOption) error {
opts = append(opts, option.WithScreenShotFileName(fmt.Sprintf("tap_by_ocr_%s", text)))
}
point, err := dExt.FindScreenText(text, opts...)
textRect, err := dExt.FindScreenText(text, opts...)
if err != nil {
if actionOptions.IgnoreNotFoundError {
return nil
}
return err
}
point := textRect.Center()
return dExt.TapAbsXY(point.X, point.Y, opts...)
}