From cbec90403c1b48263ee43982829b012ab8109260 Mon Sep 17 00:00:00 2001 From: buyuxiang <347586493@qq.com> Date: Mon, 4 Sep 2023 22:11:24 +0800 Subject: [PATCH] return the first one matched exactly when index not specified --- hrp/pkg/uixt/service_vedem.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hrp/pkg/uixt/service_vedem.go b/hrp/pkg/uixt/service_vedem.go index 716f33e9..c5f45395 100644 --- a/hrp/pkg/uixt/service_vedem.go +++ b/hrp/pkg/uixt/service_vedem.go @@ -134,6 +134,11 @@ func (t OCRTexts) FindText(text string, options ...ActionOption) (result OCRText } results = append(results, ocrText) + + // return the first one matched exactly when index not specified + if ocrText.Text == text && actionOptions.Index == 0 { + return ocrText, nil + } } if len(results) == 0 {