I have used app.staticTexts["String"].tap()
to tap on a button containing that string which is working completely fine.
But the problem here is that i want to print all the static
texts which are present on that page, how can i do it in XCUITest
?
My aim here is to iterate through all the static
texts present on the page and then add an if
condition on my expected text.
You can use something like that:
for staticText in app.staticTexts.allElementsBoundByIndex {
if staticText.label == "test" {
}
}