Element identification using iOS Predicate String

I would like to click the first three records one by one in a table. So I used the below iOS Predicate method to click but getting Nosuch element exception.

I did search a lot in google to figure out the correct syntax but apparently not succeed yet. Any assistance?

Note: The name/id/value are dynamic and hence can’t be predetermined. Also I wish to not go with XPATH due to performance issue.

Mobile: IOS Native App. Appium: 1.8.2 Java client: 6.1.0

cucumber.runtime.CucumberException: org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.


public static void ClickusingPredicateString(String selector) {

Element(under for loop to increment the record position):

type == ‘XCUIElementTypeCell[1]’ AND visible==1
type == ‘XCUIElementTypeCell[2]’ AND visible==1
type == ‘XCUIElementTypeCell[2]’ AND visible==1Sample record

Thanks for your time!

I have already referred the same and applied in my code but apparently stuck with same issue. :frowning:

By predicate location is unable to select elements by their indexes. You could either select all visible cells

type == ‘XCUIElementTypeCell’ AND visible == 1

and then get the first three matches from the resulting array or use class chain locator to select elements by their indexes:

**/XCUIElementTypeCell[visible == 1][1]