Issue with List interface

I am using the List interface to get the list of courses in an application. The list size should be around 30. But the list is considering only 9 values which displayed on the home page.

For the remaining values, one needs to scroll down on the same page. Why is it so? Why the list is not taking all the values, even though the locator id is same for all the values.

List <(WebElement)> course = driver.findElements(By.id(“com.vector.guru99:id/lblinterviewHeader”));
course.get(26).click();

When I run the above code, I get an Array Index out of bounds Exception as the list has only 9 values in it.

Cheers

With Android you can see only what on screen. So you should scroll and check -> scroll and check -> tap if found.

or use Automator to find element by text:

driver.findElement(MobileBy
                        .AndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView("
                                + "new UiSelector().text(\"" + your_text + "\"));")).click()