美文网首页初见
Xcode UITest 报错 Multiple matchin

Xcode UITest 报错 Multiple matchin

作者: 红色小星 | 来源:发表于2020-02-07 14:51 被阅读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

    相关文章

      网友评论

        本文标题:Xcode UITest 报错 Multiple matchin

        本文链接:https://www.haomeiwen.com/subject/lgbmxhtx.html