mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-03 06:49:38 +08:00
feat: add auto popups handler in swipe find
This commit is contained in:
@@ -344,7 +344,7 @@ func (dExt *DriverExt) GetScreenResult() (screenResult *ScreenResult, err error)
|
||||
|
||||
imageResult, err := dExt.ImageService.GetImage(bufSource)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("GetScreenResult failed")
|
||||
log.Error().Err(err).Msg("GetImage from ImageService failed")
|
||||
return
|
||||
}
|
||||
imageResult.imagePath = imagePath
|
||||
|
||||
@@ -135,14 +135,20 @@ func (dExt *DriverExt) swipeToTapTexts(texts []string, options ...ActionOption)
|
||||
var point PointF
|
||||
findTexts := func(d *DriverExt) error {
|
||||
var err error
|
||||
ocrTexts, err := d.GetScreenTexts()
|
||||
screenTexts, err := d.GetScreenTexts()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
points, err := ocrTexts.FindTexts(texts, dExt.ParseActionOptions(options...)...)
|
||||
points, err := screenTexts.FindTexts(texts, dExt.ParseActionOptions(options...)...)
|
||||
if err != nil {
|
||||
// target texts not found, try to auto handle popup
|
||||
if e := dExt.AutoPopupHandler(screenTexts); e != nil {
|
||||
log.Error().Err(e).Msg("auto handle popup failed")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// target texts found, pick the first one
|
||||
point = points[0].Center() // FIXME
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user