mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-30 12:59:39 +08:00
refactor: rename files
This commit is contained in:
38
pkg/uixt/driver_ext_tap.go
Normal file
38
pkg/uixt/driver_ext_tap.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package uixt
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt/option"
|
||||
)
|
||||
|
||||
func (dExt *XTDriver) TapByOCR(text string, opts ...option.ActionOption) error {
|
||||
actionOptions := option.NewActionOptions(opts...)
|
||||
if actionOptions.ScreenShotFileName == "" {
|
||||
opts = append(opts, option.WithScreenShotFileName(fmt.Sprintf("tap_by_ocr_%s", text)))
|
||||
}
|
||||
|
||||
point, err := dExt.FindScreenText(text, opts...)
|
||||
if err != nil {
|
||||
if actionOptions.IgnoreNotFoundError {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return dExt.TapAbsXY(point.X, point.Y, opts...)
|
||||
}
|
||||
|
||||
func (dExt *XTDriver) TapByCV(opts ...option.ActionOption) error {
|
||||
options := option.NewActionOptions(opts...)
|
||||
|
||||
point, err := dExt.FindUIResult(opts...)
|
||||
if err != nil {
|
||||
if options.IgnoreNotFoundError {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return dExt.TapAbsXY(point.X, point.Y, opts...)
|
||||
}
|
||||
Reference in New Issue
Block a user