feat: tap random point in ocr text rect

This commit is contained in:
lilong.129
2025-03-17 15:36:35 +08:00
parent 7f69052be6
commit b34a2218fe
6 changed files with 36 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ package uixt
import (
"fmt"
"github.com/httprunner/httprunner/v5/uixt/ai"
"github.com/httprunner/httprunner/v5/uixt/option"
)
@@ -19,7 +20,13 @@ func (dExt *XTDriver) TapByOCR(text string, opts ...option.ActionOption) error {
}
return err
}
point := textRect.Center()
var point ai.PointF
if actionOptions.TapRandom {
point = textRect.RandomPoint()
} else {
point = textRect.Center()
}
return dExt.TapAbsXY(point.X, point.Y, opts...)
}