如何通过XCUITest测试UITableView [英] How to test UITableView by XCUITest
本文介绍了如何通过XCUITest测试UITableView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有.
我正在通过XCUITest编写测试代码. 我想测试UITableView. 但是我现在无法在UITableView上进行测试. 我不知道为什么手机点击没有反应.
I'm writing test code by XCUITest. I want to test UITableView. But I couldn't test now on UITableView. I don't know why cell tap has no response.
我写了以下代码.
let tablesQuery = app.tables
app.tables.cells.staticTexts["山手線"].tap()
tablesQuery.staticTexts["山手線"].tap()
tablesQuery.staticTexts["山手線"].tap()
tablesQuery.staticTexts["渋谷"].tap()
tablesQuery.staticTexts["大崎"].tap()
tablesQuery.staticTexts["山手線"].tap()
经过测试的视图是以下捕获内容.
The view which was tested is the following capture.
我的测试代码发出了以下错误.
And my test code put out the following error.
此页面具有UITableView. 我不知道为什么手机点击没有反应.
This page has UITableView. I don't know why cell tap has no response.
这是什么问题?
推荐答案
我自己解决了. 我已经设置了一些可访问性.
I have resolved by myself. I have setted accessibility something.
self.workview.isAccessibilityElement = true
self.workview.accessibilityLabel = "workview"
我注释掉上面的代码后,我可以进行测试.
after I comment out the above code,I could test.
谢谢!
这篇关于如何通过XCUITest测试UITableView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文