【发布时间】:2016-11-23 12:51:10
【问题描述】:
我正在尝试将图像拖动到我的应用程序中的特定布局,我可以点击图像但无法跨拖放区移动。并尝试了以下解决方案:
1
let startCoord = XCUIApplication().cells.element(boundBy: 0).coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.01));
let endCoord = startCoord.withOffset(CGVector(dx: 0.0, dy: -900));
startCoord.press(forDuration: 0.25, thenDragTo: endCoord)
2
let fromCoordinate = XCUIApplication().coordinate(withNormalizedOffset:CGVector(dx: 5, dy:10))
let toCoordinate = XCUIApplication().coordinate(withNormalizedOffset:CGVector(dx: 5, dy: 20))
fromCoordinate.press(forDuration: 5, thenDragTo: toCoordinate)
Locating through coordinates.
但我仍然无法找出解决方案。
有人知道如何在 Xcode 8.1 中正确执行拖放操作吗?
【问题讨论】:
-
你能打印出方法 1 和 2 的 from/to 坐标 x 和 y 值,然后发布吗?
标签: xcode xctest xcode-ui-testing