mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 08:59:44 +08:00
replace AutoPopupHandler with ClosePopupsHandler
This commit is contained in:
@@ -137,15 +137,19 @@ func (dExt *DriverExt) swipeToTapTexts(texts []string, options ...ActionOption)
|
||||
var point PointF
|
||||
findTexts := func(d *DriverExt) error {
|
||||
var err error
|
||||
screenTexts, err := d.GetScreenTexts()
|
||||
screenResult, err := d.GetScreenResult(
|
||||
WithScreenShotOCR(true),
|
||||
WithScreenShotUpload(true),
|
||||
WithScreenShotClosePopups(true),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
points, err := screenTexts.FindTexts(texts, dExt.ParseActionOptions(options...)...)
|
||||
points, err := screenResult.Texts.FindTexts(texts, dExt.ParseActionOptions(options...)...)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("swipeToTapTexts failed")
|
||||
// target texts not found, try to auto handle popup
|
||||
if e := dExt.handleTextPopup(screenTexts); e != nil {
|
||||
if e := dExt.tapPopupHandler(screenResult.Popup); e != nil {
|
||||
log.Error().Err(e).Msg("auto handle popup failed")
|
||||
}
|
||||
return err
|
||||
|
||||
@@ -317,7 +317,7 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) {
|
||||
if feedVideo.VideoID == crawler.lastFeed.VideoID {
|
||||
// app event tracking not changed
|
||||
// check and handle popups
|
||||
if err = crawler.driverExt.AutoPopupHandler(); err != nil {
|
||||
if err = crawler.driverExt.ClosePopupsHandler(WithMaxRetryTimes(1)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,7 +624,7 @@ func runStepMobileUI(s *SessionRunner, step *TStep) (stepResult *StepResult, err
|
||||
}
|
||||
|
||||
// automatic handling of pop-up windows on each step finished
|
||||
if err2 := uiDriver.AutoPopupHandler(); err2 != nil {
|
||||
if err2 := uiDriver.ClosePopups(); err2 != nil {
|
||||
log.Error().Err(err2).Str("step", step.Name).Msg("auto handle popup failed")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user