My requirement includes selecting of checkboxes for all the items. Attributes avail which are index, resource-id are static. The instance is of dynamic & increases with the items list.
ref:: 0,1,2,3 et…
How to select the checkboxes of the list in appium??
Selenium supports selecting multiple elements by one XPath statement… put an ‘s’ behind .findElement to get an array/list of WebElements… it would be .findElementsByXPath(…)… You can also do webElement.findElementsByXPath(…) if you want to first select the element that contains your whole list and then select the individual list items out in into an array… Once you have your list, you can iterate over it in a for loop
I have some idle time at work and reread your post… Your XPath is a little special and you may not be able to get it done with a list of elements… you could also try:
int i = 0;
while(true){
WebElement checkboxallSelection = driver.findElementByXPath(“//android.widget.paths[contains(@instance, “+i+”)]”);
if(checkboxallSelection == null){
break;
}
checkboxallSelection.click();
i++
}