IOS UITableview Automation with appium

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

Now I use this method to push a cell in a tableview

wait.until(ExpectedConditions.visibilityOf(driver.findElementByAccessibilityId(element))).click(); 

But its not working as the 25th element has not yet been added to the view. Note that I am adding an accessibility identifier for the table view cell dynamically in code.

How can I do this job?

***** Added more ******

I have a table view cell displaying two text views. Short name of the currency and long name of the currency.

Let's look at an example.

GBP

UK Pounds

Now the accessibility identifier for this tableview cell is set as Pounds Sterling. Now i tried

driver.scrollTo ("GBP") and driver.scrollTo ("British Pounds")

Both did not work. I get an error

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

Thanks.

+5
source share
1 answer
  String ReqN = "Your required string"; boolean flag = true; while (flag) { for (i=1;i<=6;i++) { String GetN = driver.findElement(By.xpath("//android.widget.HorizontalScrollView/android.widget.LinearLayout[" + i + "]")).getText(); if (GetN.equals(ReqN)) { flag = false; System.out.println("Your result found"); } } if (flag) { driver.swipe(145, 765, 145, 180, 3000); } } 

String ReqN :: Your predefined string

String GetN :: Text get for each element [from 1 to 6, which we get for the loop]

Thus, it receives the text and matches the first six elements if your predetermined text is not found, and then it scrolls from the given axes [which is the 6th element of the 1st element] .. so you get a new six elements and the loop will executed again.

Ref. Image Elements and points X, Y

+1
source

Source: https://habr.com/ru/post/1246685/


All Articles