mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-04 23:16:57 +08:00
change: handle popup with regex
This commit is contained in:
@@ -200,7 +200,7 @@ type LiveCrawler struct {
|
|||||||
|
|
||||||
func (l *LiveCrawler) checkLiveVideo(texts OCRTexts) (enterPoint PointF, yes bool) {
|
func (l *LiveCrawler) checkLiveVideo(texts OCRTexts) (enterPoint PointF, yes bool) {
|
||||||
// 预览流入口:DY/KS
|
// 预览流入口:DY/KS
|
||||||
points, err := texts.FindTexts([]string{".?点击进入直播间"}, WithRegex(true))
|
points, err := texts.FindTexts([]string{".*点击进入直播间"}, WithRegex(true))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return points[0].Center(), true
|
return points[0].Center(), true
|
||||||
}
|
}
|
||||||
@@ -434,8 +434,9 @@ func (dExt *DriverExt) assertActivity(packageName, activityType string) error {
|
|||||||
|
|
||||||
// TODO: add more popup texts
|
// TODO: add more popup texts
|
||||||
var popups = [][]string{
|
var popups = [][]string{
|
||||||
{"青少年模式", "我知道了"}, // 青少年弹窗
|
{".*青少年.*", "我知道了"}, // 青少年弹窗
|
||||||
{"个人信息保护指引", "同意"},
|
{".*个人信息保护.*", "同意"},
|
||||||
|
{".*更新.*", "以后再说"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dExt *DriverExt) autoPopupHandler(ocrResult *OcrResult) error {
|
func (dExt *DriverExt) autoPopupHandler(ocrResult *OcrResult) error {
|
||||||
@@ -444,7 +445,7 @@ func (dExt *DriverExt) autoPopupHandler(ocrResult *OcrResult) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
points, err := ocrResult.Texts.FindTexts([]string{popup[0], popup[1]})
|
points, err := ocrResult.Texts.FindTexts([]string{popup[0], popup[1]}, WithRegex(true))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Warn().Interface("popup", popup).
|
log.Warn().Interface("popup", popup).
|
||||||
Interface("texts", ocrResult.Texts).Msg("text popup found")
|
Interface("texts", ocrResult.Texts).Msg("text popup found")
|
||||||
|
|||||||
Reference in New Issue
Block a user