fix tap_cv params type assertion

This commit is contained in:
buyuxiang
2023-06-08 13:59:57 +08:00
parent f84f393130
commit 6b5582a07d
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -1 +1 @@
v4.3.3.2305301203 v4.3.3.2306081354
+6 -1
View File
@@ -616,7 +616,12 @@ func (dExt *DriverExt) DoAction(action MobileAction) error {
if imagePath, ok := action.Params.(string); ok { if imagePath, ok := action.Params.(string); ok {
return dExt.TapByCV(imagePath, WithDataIdentifier(action.Identifier), WithDataIgnoreNotFoundError(true), WithDataIndex(action.Index)) return dExt.TapByCV(imagePath, WithDataIdentifier(action.Identifier), WithDataIgnoreNotFoundError(true), WithDataIndex(action.Index))
} }
if uiTypes, ok := action.Params.([]string); ok { if uiParams, ok := action.Params.([]interface{}); ok {
var uiTypes []string
for _, uiParam := range uiParams {
uiType, _ := uiParam.(string)
uiTypes = append(uiTypes, uiType)
}
return dExt.TapByUIDetection(uiTypes, WithDataIdentifier(action.Identifier), WithDataIgnoreNotFoundError(true), WithDataIndex(action.Index)) return dExt.TapByUIDetection(uiTypes, WithDataIdentifier(action.Identifier), WithDataIgnoreNotFoundError(true), WithDataIndex(action.Index))
} }
return fmt.Errorf("invalid %s params: %v", ACTION_TapByCV, action.Params) return fmt.Errorf("invalid %s params: %v", ACTION_TapByCV, action.Params)