Xcode UITest 报错 Multiple matching elements found for

请教大佬 这个怎么解决?

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 .
Sparse tree of matches:
→Application, pid: 20378
↳Window
↳Other
↳Other
↳Other
↳Other
↳Other
↳Other
↳Other
↳Other

你可能感兴趣的:(Xcode UITest 报错 Multiple matching elements found for)