mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-10 17:43:00 +08:00
fix: remove unnecessary IgnoreNotFoundError and MaxRetryTimes from coordinate-based tap tools
- Removed IgnoreNotFoundError and MaxRetryTimes parameters from TapRequest, TapAbsXYRequest, and DoubleTapXYRequest structures - Updated corresponding tool implementations to remove references to these non-existent fields - These parameters are not applicable to coordinate-based operations as they don't involve element searching - Only OCR/CV-based operations need these error handling parameters This ensures that only relevant tools have the ignore_NotFoundError functionality, making the API more consistent and avoiding confusion.
This commit is contained in:
@@ -1 +1 @@
|
||||
v5.0.0-beta-2505262202
|
||||
v5.0.0-beta-2505262210
|
||||
|
||||
@@ -316,18 +316,10 @@ func (t *ToolTapXY) Implement() server.ToolHandlerFunc {
|
||||
// Build action options from request structure
|
||||
var opts []option.ActionOption
|
||||
|
||||
// Add boolean options
|
||||
if tapReq.IgnoreNotFoundError {
|
||||
opts = append(opts, option.WithIgnoreNotFoundError(true))
|
||||
}
|
||||
|
||||
// Add numeric options
|
||||
if tapReq.Duration > 0 {
|
||||
opts = append(opts, option.WithDuration(tapReq.Duration))
|
||||
}
|
||||
if tapReq.MaxRetryTimes > 0 {
|
||||
opts = append(opts, option.WithMaxRetryTimes(tapReq.MaxRetryTimes))
|
||||
}
|
||||
|
||||
// Add default options
|
||||
opts = append(opts, option.WithPreMarkOperation(true))
|
||||
@@ -394,18 +386,10 @@ func (t *ToolTapAbsXY) Implement() server.ToolHandlerFunc {
|
||||
// Build action options from request structure
|
||||
var opts []option.ActionOption
|
||||
|
||||
// Add boolean options
|
||||
if tapAbsReq.IgnoreNotFoundError {
|
||||
opts = append(opts, option.WithIgnoreNotFoundError(true))
|
||||
}
|
||||
|
||||
// Add numeric options
|
||||
if tapAbsReq.Duration > 0 {
|
||||
opts = append(opts, option.WithDuration(tapAbsReq.Duration))
|
||||
}
|
||||
if tapAbsReq.MaxRetryTimes > 0 {
|
||||
opts = append(opts, option.WithMaxRetryTimes(tapAbsReq.MaxRetryTimes))
|
||||
}
|
||||
|
||||
// Tap absolute XY action logic
|
||||
log.Info().Float64("x", tapAbsReq.X).Float64("y", tapAbsReq.Y).Msg("tapping at absolute coordinates")
|
||||
|
||||
@@ -16,11 +16,9 @@ type TargetDeviceRequest struct {
|
||||
|
||||
type TapRequest struct {
|
||||
TargetDeviceRequest
|
||||
X float64 `json:"x" binding:"required" desc:"X coordinate (0.0~1.0 for percent, or absolute pixel value)"`
|
||||
Y float64 `json:"y" binding:"required" desc:"Y coordinate (0.0~1.0 for percent, or absolute pixel value)"`
|
||||
Duration float64 `json:"duration" desc:"Tap duration in seconds (optional)"`
|
||||
IgnoreNotFoundError bool `json:"ignore_NotFoundError" desc:"Ignore error if target element not found"`
|
||||
MaxRetryTimes int `json:"max_retry_times" desc:"Maximum retry times for the tap action"`
|
||||
X float64 `json:"x" binding:"required" desc:"X coordinate (0.0~1.0 for percent, or absolute pixel value)"`
|
||||
Y float64 `json:"y" binding:"required" desc:"Y coordinate (0.0~1.0 for percent, or absolute pixel value)"`
|
||||
Duration float64 `json:"duration" desc:"Tap duration in seconds (optional)"`
|
||||
}
|
||||
|
||||
type DragRequest struct {
|
||||
@@ -157,11 +155,9 @@ type GetSourceRequest struct {
|
||||
|
||||
type TapAbsXYRequest struct {
|
||||
TargetDeviceRequest
|
||||
X float64 `json:"x" binding:"required" desc:"Absolute X coordinate in pixels"`
|
||||
Y float64 `json:"y" binding:"required" desc:"Absolute Y coordinate in pixels"`
|
||||
Duration float64 `json:"duration" desc:"Tap duration in seconds (optional)"`
|
||||
IgnoreNotFoundError bool `json:"ignore_NotFoundError" desc:"Ignore error if target element not found"`
|
||||
MaxRetryTimes int `json:"max_retry_times" desc:"Maximum retry times for the tap action"`
|
||||
X float64 `json:"x" binding:"required" desc:"Absolute X coordinate in pixels"`
|
||||
Y float64 `json:"y" binding:"required" desc:"Absolute Y coordinate in pixels"`
|
||||
Duration float64 `json:"duration" desc:"Tap duration in seconds (optional)"`
|
||||
}
|
||||
|
||||
type TapByOCRRequest struct {
|
||||
@@ -185,10 +181,8 @@ type TapByCVRequest struct {
|
||||
|
||||
type DoubleTapXYRequest struct {
|
||||
TargetDeviceRequest
|
||||
X float64 `json:"x" binding:"required" desc:"X coordinate (0.0~1.0 for percent, or absolute pixel value)"`
|
||||
Y float64 `json:"y" binding:"required" desc:"Y coordinate (0.0~1.0 for percent, or absolute pixel value)"`
|
||||
IgnoreNotFoundError bool `json:"ignore_NotFoundError" desc:"Ignore error if target element not found"`
|
||||
MaxRetryTimes int `json:"max_retry_times" desc:"Maximum retry times for the tap action"`
|
||||
X float64 `json:"x" binding:"required" desc:"X coordinate (0.0~1.0 for percent, or absolute pixel value)"`
|
||||
Y float64 `json:"y" binding:"required" desc:"Y coordinate (0.0~1.0 for percent, or absolute pixel value)"`
|
||||
}
|
||||
|
||||
type SwipeAdvancedRequest struct {
|
||||
|
||||
Reference in New Issue
Block a user