From f720eaacfb9c78854179c9a6d6d30b3c7827fd41 Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Thu, 4 May 2023 20:32:52 +0800 Subject: [PATCH] change: autoPopupHandler --- hrp/pkg/uixt/video_crawler.go | 10 +++++----- hrp/pkg/uixt/video_crawler_test.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hrp/pkg/uixt/video_crawler.go b/hrp/pkg/uixt/video_crawler.go index 01225fbf..5e9968c4 100644 --- a/hrp/pkg/uixt/video_crawler.go +++ b/hrp/pkg/uixt/video_crawler.go @@ -423,9 +423,8 @@ func (dExt *DriverExt) assertActivity(packageName, activityType string) error { // TODO: add more popup texts var popups = [][]string{ - {"青少年", "我知道了"}, // 青少年弹窗 - {"允许", "拒绝"}, - {"确定", "取消"}, + {"青少年模式", "我知道了"}, // 青少年弹窗 + {"个人信息保护指引", "同意"}, } func (dExt *DriverExt) autoPopupHandler(ocrResult *OcrResult) error { @@ -434,9 +433,10 @@ func (dExt *DriverExt) autoPopupHandler(ocrResult *OcrResult) error { continue } - points, err := ocrResult.Texts.FindTexts([]string{"确定", "取消"}) + points, err := ocrResult.Texts.FindTexts([]string{popup[0], popup[1]}) if err == nil { - log.Warn().Msg("text popup found") + log.Warn().Interface("popup", popup). + Interface("texts", ocrResult.Texts).Msg("text popup found") point := points[1].Center() if err := dExt.TapAbsXY(point.X, point.Y); err != nil { log.Error().Err(err).Msg("tap popup failed") diff --git a/hrp/pkg/uixt/video_crawler_test.go b/hrp/pkg/uixt/video_crawler_test.go index d74b9016..5044df5d 100644 --- a/hrp/pkg/uixt/video_crawler_test.go +++ b/hrp/pkg/uixt/video_crawler_test.go @@ -14,8 +14,8 @@ func TestVideoCrawler(t *testing.T) { Feed: FeedConfig{ TargetCount: 5, TargetLabels: []TargetLabel{ - {Text: `^广告$`, Scope: Scope{0, 0.5, 1, 1}, Regex: true, Target: 2}, - {Text: `^图文$`, Scope: Scope{0, 0.5, 1, 1}, Regex: true}, + {Text: `^广告$`, Scope: Scope{0, 0.5, 1, 1}, Regex: true}, + {Text: `^图文$`, Scope: Scope{0, 0.5, 1, 1}, Regex: true, Target: 2}, {Text: `^特效\|`, Scope: Scope{0, 0.5, 1, 1}, Regex: true}, {Text: `^模板\|`, Scope: Scope{0, 0.5, 1, 1}, Regex: true}, {Text: `^购物\|`, Scope: Scope{0, 0.5, 1, 1}, Regex: true},