You can't guard a value that doesn't exist yet
说明与用途
在 iOS 18.5 上的 WebDriverAgent 中,应用切换后执行拖拽手势会导致挂起并出现无限点错误。修复通过新方法立即解析坐标、验证并合成事件,消除了挂起并返回清晰的 400 错误。
问题
Drag gestures in WebDriverAgent hang and fail with an infinite-point assertion when the target app is busy after a switch.
结果
The new implementation removes the hang, provides a clear 400 error for invalid parameters, and aligns WDA’s drag behavior with W3C actions.
工作流
- 1. Resolve start and end coordinates immediately using screenPoint.
- 2. Validate that both points are finite; if not, return a 400 error with a clear message.
- 3. Map velocity to XCTest’s pixels-per-second values (default 500, slow 250, fast 750).
- 4. Build the touch event path: press, hold, drag, hold, lift.
- 5. Send the event directly to FBXCTestDaemonsProxy, bypassing XCTest’s snapshot and idle wait.
- 6. Wait up to animationCoolOffTimeout after the gesture, mirroring W3C actions.
- 7. Return success or a 400 error based on validation.
- 8. Update /wda/dragfromtoforduration and /wda/pressAndDragWithVelocity to use the new method.
证据
unknown error: Invalid parameter not satisfying: point.x != INFINITY && point.y != INFINITY
Both endpoints called -[XCUICoordinate pressForDuration:thenDragToCoordinate:(withVelocity:thenHoldForDuration:)]
A new -[XCUIApplication fb_pressAtCoordinate:forDuration:thenDragToCoordinate:withVelocity:thenHoldForDuration:error:]
- 记录日期: 2026-10-14T13:41:20.101Z