Billy Boyo Billy Boyo - 3 years ago 100
iOS Question

ui testing xcode, how to tap on a table view cell button with cellquery

I am currently doing ui tests for my app and stuck on clicking on the log in button of my app. I am unable to find the element which i have gave the identifier signup button(the element is the 3rd by index, this is not the issue).

let cellQuery = self.app.tables.cells.elementBoundByIndex(3)

let signInButton = cellQuery.buttons["signup button"]
if signInButton.exists {
signInButton.tap()
}

Answer Source

If the button is present in the 3rd cell then it should be:

let cellQuery = self.app.tables.cells.elementBoundByIndex(2)
cellQuery.buttons["signup button"].tap()

If button is 3rd in the cell then add accessibility for the cells and then:

app.cells["AccessibilityIdentifier"].buttons.elementBoundByIndex(2).tap()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download