Unable to select an image in Android mobile application

I am automating an android mobile application.
I was successfully able to use click for clicking on a menu button.
But I am unable to click/select an image after scrolling down.
I have tried using xpath, index, resource id, class name and there combination in xpath aswell.

@nida333 : Can you post screenshot of uiautomatorviewer or appium inspector?

and this is how i accessed it
driver.FindElementByXPath("//*[@class=‘android.widget.ImageView’ and @index=‘0’]").Click();

Because your image has ID so you don’t have to use xpath.


If you have more than one ImageView with same ID then store the elements in List and the iterate through each.

I am new to this, can you please tell me how to iterate through each
and secondly i only want to click on the first image.

If you want to click on first image only then you don’t have to iterate through all.

 List<WebElement> images = driver.findElements(By.id("image_cdp_item_image"));

Now unable to use .list

How to use List method?

import java.util.List;

Also, I used <WebElement> instead of <IWebElement>

Can you please guide me to do in C#
Kindly see the attached image for reference of issue that i am facing

I used following for c# and it worked fine.

IList links = driver.FindElements(By.Id(“cc”));

Thank you so much @Suman_Bala :slight_smile:

1 Like