fix: compatible with swipe params

This commit is contained in:
buyuxiang
2023-09-26 18:09:47 +08:00
committed by buyuxiang
parent c1f7452ea1
commit 3613ffb2c0
3 changed files with 5 additions and 2 deletions

View File

@@ -1 +1 @@
v4.3.6
v4.3.6.20230926

View File

@@ -114,7 +114,7 @@ func (dExt *DriverExt) prepareSwipeAction(options ...ActionOption) func(d *Drive
log.Error().Err(err).Msgf("swipe %s failed", d)
return err
}
} else if d, ok := swipeDirection.([]float64); ok {
} else if d, ok := swipeDirection.([]float64); ok && len(d) == 4 {
// custom direction: [fromX, fromY, toX, toY]
if err := dExt.SwipeRelative(d[0], d[1], d[2], d[3], options...); err != nil {
log.Error().Err(err).Msgf("swipe from (%v, %v) to (%v, %v) failed",

View File

@@ -380,6 +380,9 @@ func convertCompatMobileStep(mobileStep *MobileStep) {
if ma.Method == uixt.ACTION_SwipeToTapText && actionOptions.MaxRetryTimes == 0 {
ma.ActionOptions.MaxRetryTimes = 10
}
if ma.Method == uixt.ACTION_Swipe {
ma.ActionOptions.Direction = ma.Params
}
mobileStep.Actions[i] = ma
}
}