How to swipe to a specific contact in my contact list?

How to swipe to a specific contact given in the bottom of my contact list?
As if i call swipe object it swipes only once.
Is there any way to swipe up to a specific point.
I have tried driver.scrollTo(“StringText”); also but find myself unable.

If this is Android, you can use the UiAutomator APIs that are available on Android 17+; you can pass in a UiAutomator Java-syntax string to the AndroidDriver to search for the text.

If you’re not familiar, you’ll have to write a loop that repeatedly calls driver.swipe (or uses TouchActions) and searches the screen for TextViews that have the text you’re looking for. You’ll have to add in some sort of check to make sure you’re not swiping forever if you don’t find your text, though.

Hii @afwang,
I tried but unable to do.
Can you help me with it?
Here is the link:


The way I do it is creating a While loop that continues to swipe down until i find the TableCell that contains the text I want to swipe to

I have two applications, one is like contact list and in this i used loop and it worked.
But in the second application, no swipe is required. The problem which i am facing is how to tap on any specific image.
In this second application, all properties are same of all elements (i.e., no resource-id is given, same class, same package, same content etc.), there is only one thing which is different and that is bounds of these images.
So can you tell me how to tap on any specific image?


Are you testing iOS or Android? Can you screenshot your inspector and tell what element you are trying to reach?

Sir i am testing android application.
These are the screenshots of application :-

anybody here to help??
I am stuck here!!


You could use a List to store all elements and you can tab different elements based on the indexes of the list, if you are using page objects.

For example (I use C#) :

[FindsByAndroidUIAutomator(XPath = “//android.widget.LinearLayout//descendant::android.widget.ImageView[contains(@index,‘0’)]”]
public IList <iIWebElement> My_Contact_List;

Then you can tap them by : My_Contact_List[index].Click();

If you are not using Page Objects :

IList <iIWebElement> My_Contact_List = Driver.FindElements(By.XPath(//android.widget.LinearLayout//descendant::android.widget.ImageView[contains(@index,‘0’)]));

If the index search does not give the desired results try without the index ‘0’ . or you can add the complete xpath with descendant classes.


Thanks @Gery
i tried it but every image is giving the same id

What do you mean same id ? do you at least find one element ?

Yeah, i used List to get all WebElement id’s.
And i got the id’s for every element(you can say image) but all were same.

Can you tap names to enter contact details ? or only the photos can be tapped ?

If you can tap the Name as well, then you need to do the above but for the TextView widget and get complete list of elements each with its own name.

If it is only clickable on the photos, you can search the list of names and create a method that clicks right above the name element (meaning the photo).

Other than that, i don`t know what workaround you can do without asking dev team to add resource-id or adding the names to the photo as well.

Hope you see it through,

In my application there are only images to tap.
You can see this in the screenshots which i posted above.

There are three rows, each row have multiple images.
If i inspect these images using uiautomator then the complete row shows same properties (in terms of id, xpath etc.)
Just checkout the screenshots.!!