Hi,
Thanks for your reply. i am able to find all the elements. Got into another issue.
i am able to click only first element in the list when iterate through the list. how can i click all the elements one by one.
For ex: when i open whats app, i can see 3 elements in linear layout as given below
"CALLS" "CHAT" "CONTACTS"
i am able to click calls successfully and not able to click remaining ones. Getting element not found exception.
Following is the text and corresponding xpath which i got when i run the script.
CALLS
[[AndroidDriver: Android on LINUX (f97ff732-a84a-4a48-b45c-0362af37dcdb)] -> xpath: //android.widget.TextView[@resource-id='com.whatsapp:id/tab']]
CHATS
[[AndroidDriver: Android on LINUX (f97ff732-a84a-4a48-b45c-0362af37dcdb)] -> xpath: //android.widget.TextView[@resource-id='com.whatsapp:id/tab']]
CONTACTS
[[AndroidDriver: Android on LINUX (f97ff732-a84a-4a48-b45c-0362af37dcdb)] -> xpath: //android.widget.TextView[@resource-id='com.whatsapp:id/tab']]
since i have same xpath for all three elements, i am able to click only "CALLS". i am trying with below code
List list1=d.findElements(By.xpath("//android.widget.TextView[@resource-id='com.whatsapp:id/tab']"));
System.out.println(list1.size());
System.out.println(s.length);
for(int j=0;j {
System.out.println(list1.get(j).getText());
System.out.println(list1.get(j));
list1.get(j).click();
Thread.sleep(5000);
}
Please help.