How to use UIAutomation to select image from UIImagePickerController

前端 未结 3 884
逝去的感伤
逝去的感伤 2021-01-19 03:22

We are trying to get a UIAutomation test around a flow in our app where a user selects an image from a UIImagePickerController. All the automation works great, until we try

相关标签:
3条回答
  • 2021-01-19 03:54

    So, I figured this out. Duh. I just needed to access the visible cells and send the tap to one of those. Works like a charm.

    window.collectionViews()[0].visibleCells()[0].tap();
    

    I hope this helps someone else!

    0 讨论(0)
  • 2021-01-19 03:56

    I fixed this by

    app.tables.cells.element(boundBy: 1).tap()  
    // this table has two rows // 1- Moments  // 2- Camera role
    app.collectionViews["PhotosGridView"].cells["Photo, Landscape, January 11, 6:34 PM"].tap() // I want to select this item from moments
    

    It is working.

    0 讨论(0)
  • 2021-01-19 04:05

    First I pick the moments row, and then I select the photo. Later I click the button choose that confirms the picked image.

        let moments = app.tables.cells.element(boundBy: 0)
        moments.tap()
        sleep(3)
        let selectedPhoto = app.collectionViews.element(boundBy: 0).cells.element(boundBy: 0)
        sleep(3)
        selectedPhoto.tap()
        sleep(3)
        //Choose Button
        let chooseButton = app.buttons.element(boundBy: 1)
        chooseButton.tap()
    

    Hope it helps

    0 讨论(0)
提交回复
热议问题