Fro*_*art 4 xcode objective-c ios xcode7 xcode-ui-testing
如何通过Xcode中的UI测试执行"向左滑动"操作以触发segue并更改视图控制器?
录制的代码是
[[[[[[[XCUIApplication alloc] init].otherElements containingType:XCUIElementTypeNavigationBar identifier:@"UIView"] childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element tap];
Run Code Online (Sandbox Code Playgroud)
但似乎它不起作用 - 据我所知,视图控制器不会更改为新的.
Joe*_*tti 10
很难准确判断您要尝试滑动的视图.以下代码将在标题为"Swipe Me"的标签上执行"向左滑动"手势.定位视图后,应该很容易遵循相同的技术.
XCUIApplication *app = [XCUIApplication alloc] init];
[app.labels[@"Swipe Me"] swipeLeft];
Run Code Online (Sandbox Code Playgroud)
阅读有关swipeLeft元素的更多信息以及随附的手势.如果您正在寻找更通用的"备忘单",我也能为您提供帮助.