我们正在尝试围绕应用程序中的流进行UIAutomation测试,其中用户从UIImagePickerController中选择图像。所有自动化工作都很好,直到我们尝试从选择器 Controller 中选择一个图像为止。似乎我们无法找到正确的对象将水龙头发送到。这是我们正在尝试的:

 UIALogger.logMessage("Navigation Title: " + app.navigationTitle() );
 window.collectionViews()[0].tapWithOptions({tapOffset:{x:0.5, y:0.5}});

上面将导航标题显示为“Moments”,这意味着我们在照片选择器中,但是第二行没有出现错误-但不选择任何内容(无论坐标如何)。

该测试最终无法卡在照片选择屏幕上。

我记录了下面的元素树,您可以看到那里似乎有一个UICollectionView,但是所有单元格都是节头,并且调试日志输出中没有任何实际的“照片”。

那么,如何使用UIAutomation从UIImagePickerController中选择图像?

谢谢!

最佳答案

我通过固定

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

这是工作。

10-06 13:04
查看更多