初见

Xcode UITest 报错 Multiple matchin

2020-02-07  本文已影响0人  红色小星

请教大佬 这个怎么解决?

image.png
// 光标停在方法内 点击下面红点 开始录制脚本
- (void)testUI {
    
    
    
    XCUIApplication *app = [[XCUIApplication alloc] init];
    XCUIElementQuery *tablesQuery = app.tables;
    [tablesQuery/*@START_MENU_TOKEN@*/.staticTexts[@"UnitTestVC"]/*[[".cells.staticTexts[@\"UnitTestVC\"]",".staticTexts[@\"UnitTestVC\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/ tap];
    [app.buttons[@"Button"] tap];
    
    XCUIElement *element = [[[[[[[[app childrenMatchingType:XCUIElementTypeWindow] elementBoundByIndex:0] childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element;
    [element tap];
    [element tap];
    [element tap];
    [element tap];
    [app.navigationBars[@"UnitTestVC"].buttons[@"Back"] tap];
    [tablesQuery/*@START_MENU_TOKEN@*/.staticTexts[@"InternalStorageVC"]/*[[".cells.staticTexts[@\"InternalStorageVC\"]",".staticTexts[@\"InternalStorageVC\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/ tap];
    [app.navigationBars[@"InternalStorageVC"].buttons[@"Back"] tap];
    [tablesQuery/*@START_MENU_TOKEN@*/.staticTexts[@"CopyAndMutableCopyDemoVC"]/*[[".cells.staticTexts[@\"CopyAndMutableCopyDemoVC\"]",".staticTexts[@\"CopyAndMutableCopyDemoVC\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/ tap];
    [element tap];
    [app.navigationBars[@"LeakDemoVC"].buttons[@"CopyAndMutableCopyDemoVC"] tap];
    [app.navigationBars[@"CopyAndMutableCopyDemoVC"].buttons[@"Back"] tap];
    
    
}

Failed to get matching snapshot: Multiple matching elements found for <XCUIElementQuery: 0x280538690>.
Sparse tree of matches:
→Application, pid: 20378
↳Window
↳Other
↳Other
↳Other
↳Other
↳Other
↳Other
↳Other
↳Other

上一篇下一篇

猜你喜欢

热点阅读