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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容