Automate IOS UITableview using appium

I have a UITableView which contains about 50 elements. At any point only 6 of them are visible on screen. I want to select a cell which is not added to table view or say I need to select 25th item from the data list.

Now I am using this method for clicking a cell in tableview


But its not working as the 25th element is not added to the view yet. Please note that I am adding the accessibility identifier for the table view cell dynamically within the code.

I have added accessibility Identifier to tableview cell not to the text inside the cell.

How can I make this work?

you can click only what is visible on screen.

so do swipe until element needed will appear on screen and click on it after.

So whats the option left with me to Click an element thats not displayed in table view. I tried the scrollTo() method but that didn’t work for me either.

I have the table view cell displaying two text views. Currency Short Name and Currency Long Name.

Consider the example


Great Britain Pounds

Now the accessibility Identifier for that tableview cell is set as GBP. Now I tried

driver.scrollTo(“GBP”) and driver.scrollTo(“Great Britain Pounds”)
Both didnt work. I am getting an error message

A element could not be located on the page using the Search parameter

i never used “scrollTo” and prefer to write my own code.

mine logic for iOS is:

  1. find your element list by ID e.g. we are looking for “email_ID” in cell
  2. in list check that some element has needed text.
  3. if we did not found = return false, when we found go to Step4 :slight_smile:
  4. now we have element number in list what we need to tap do in loop:
    4.1) check if element location is on screen. if it is = tap on it and return true, if not ->
    4.2) swipe in needed directions your table and go to step 4.1


I fixed my issue. I was using wait.until(ExpectedConditions.visibilityOf(driver.findElementByAccessibilityId(element))).click();

but I replaced this with driver.findElementByAccessibilityId(element).click();

This actually made the tableview to scroll to that element and click it. I think the wait command was preventing the tableview from scrolling.