Below code throws an array illegal out of bound exception
java.util.List <MobileElement> ele = driver.findElements(By.xpath("//*[@id='com.bankappointmentschedulingmobile:id/bankType'][@index=0]"));
System.out.println(ele.size());
Random rnd = new Random();
int rndInt = rnd.nextInt(ele.size());
((org.openqa.selenium.WebElement) ele.get(rndInt)).click();
Elements in the UI automator:
