mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
feat: tap random point in ocr text rect
This commit is contained in:
@@ -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...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user