ui 测试 xcode,如何使用 cellquery 点击 table 查看单元格按钮
ui testing xcode, how to tap on a table view cell button with cellquery
我目前正在对我的应用程序进行 ui 测试,但一直点击我的应用程序的登录按钮。我无法找到我提供了标识符注册按钮的元素(该元素是索引的第三个,这不是问题)。
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()
我目前正在对我的应用程序进行 ui 测试,但一直点击我的应用程序的登录按钮。我无法找到我提供了标识符注册按钮的元素(该元素是索引的第三个,这不是问题)。
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()