[英]How do I check a cell is visible in a table view with Xcode 7 UI Testing?
[英]ui testing xcode, how to tap on a table view cell button with cellquery
我正在為我的應用程序進行ui測試,並堅持點擊我的應用程序的登錄按鈕。 我無法找到我給出標識符注冊按鈕的元素(元素是索引的第3個,這不是問題)。
let cellQuery = self.app.tables.cells.element(boundBy: 3)
let signInButton = cellQuery.buttons["signup button"]
if signInButton.exists {
signInButton.tap()
}
如果按鈕出現在第3個單元格中,那么它應該是:
let cellQuery = self.app.tables.cells.element(boundBy: 2)
cellQuery.buttons["signup button"].tap()
如果單元格中的按鈕是第3個,則為單元格添加輔助功能,然后:
app.cells["AccessibilityIdentifier"].buttons.element(boundBy: 2).tap()
可以這樣做:
XCUIApplication().tables.cells.element(boundBy: 2).buttons["signup button"].tap()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.