XCUIElement.h
类文件显示
- (void)scrollByDeltaX:(CGFloat)deltaX deltaY:(CGFloat)deltaY;
和
- (XCUICoordinate *)coordinateWithNormalizedOffset:(CGVector)normalizedOffset;
功能。但是这些不能在iOS设备上使用。 XCUIElement.h
提供了滑动表视图- (void)swipeDown
。由于向下滑动的距离不足,像 MJRefresh 一样的下拉刷新框架无法响应。
那么如何自定义位置或使用存在功能来编辑向下滑动距离呢?
您可以下拉到坐标 API 以执行下拉刷新。
let firstCell = app.staticTexts["Cell One"]
let start = firstCell.coordinateWithNormalizedOffset(CGVectorMake(0, 0))
let finish = firstCell.coordinateWithNormalizedOffset(CGVectorMake(0, 6))
start.pressForDuration(0, thenDragToCoordinate: finish)
我在我的博客上汇总了更多信息以及一个工作示例应用程序。