diff --git a/hrp/pkg/uixt/swipe.go b/hrp/pkg/uixt/swipe.go index 6b4a72ce..e3cf7f01 100644 --- a/hrp/pkg/uixt/swipe.go +++ b/hrp/pkg/uixt/swipe.go @@ -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 diff --git a/hrp/pkg/uixt/video_crawler.go b/hrp/pkg/uixt/video_crawler.go index 26d57f4e..0f8a1f75 100644 --- a/hrp/pkg/uixt/video_crawler.go +++ b/hrp/pkg/uixt/video_crawler.go @@ -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 } } diff --git a/hrp/step_mobile_ui.go b/hrp/step_mobile_ui.go index 50e22cbb..09a3f194 100644 --- a/hrp/step_mobile_ui.go +++ b/hrp/step_mobile_ui.go @@ -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") }