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.
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.
driver.findElement(By.id(âimage_cdp_item_imageâ)).click();
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"));
images.get(0).click();
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â));
links[0].Click();
Thank you so much @Suman_Bala