How to know if you have reached End Of Page while scrolling in appium

I want to know if I have reached the End Of Page in my App when I am scrolling or swiping in the App, how can I check the same ?

Hi @Abhishek_Gupta ,

You can simply identify an element which is at the end of Page, and verify whether that element is present or not.(by element.isDisplayed() or etc…). Hope this helps.!!!


Hi @bhaskar …Thanks for the answer but my List comes from an API and it is not constant…It is a dynamic list so I can’t use the same.

Have you tried with Xpath…because it represents address …,
Please have a try with XPath.

1 Like

Tried the same with XPath but Xpath is an absolute indication and it breaks with the dynamic data

It sounds like you are scrolling through the list manually. If that’s the case, you could query the current list of visible elements in between each swipe, then compare the current list against the last list. If the list is the same, the swipe had no effect and you should be at the end of the list.


@willosser The thing is I have different API’s and I don’t want know what data they will give or how many entries. My test case is actually checking for the items loading and then checking the scrolling till the End of Page is load i.e. scroll till no more scroll is applicable on the page

Hey Abhishek,
Let’s put your question in this way. If you do it manually (no automation), how will you know if you reached end of page ?
You have a set of visible items (say 5 or 6 ) at one time, all others are above in the list and not visible on the screen. @willosser is saying that, once you reach the end of the page and if you swipe again the list that is visible (i mean the 5 or 6 items) does not change because there is nothing more to be listed. That’s how you conclude that it is the end of the page. Apply same logic for appium automation.
Does that answer your question ? If not, then you have to explain how you are doing manually (no automation) and what problems you are seeing when you trying to do the exact same thing using appium ?

1 Like

That sounds correct @suratdas and @willosser , Actually I was wondering if at all there is a way in Appium to know its End of page like we do in Selenium.
The comparing between different list and the elements is what I had in mind but wanted to check if we have an explicit method or a way for doing this.

This is a very old thread. But I wanted to respond for anyone in the future wanting a solid solution.

Essentially what needs to be done to detect whether you’ve reached the bottom of a page is to check whether performing a scroll changes the page. This can be done using driver.getPageSource().

boolean endOfPage = false;
String previousPageSource = driver.getPageSource();
while (!endOfPage)
    scroll // Whatever method you choose to use
    endOfPage = previousPageSource.equals(driver.getPageSource());
    previousPageSource = driver.getPageSource();

Just for the purpose of adding a different idea to the solutions. I did something similar with the @willosser’s idea but used only the last item not the whole list. If there’s a unique data like ID, that can be used for detecting the last item and checking with the previous view’s last item. If same, it means you’re at the bottom of the list

That sounds more efficient.

In android returns false if it is not possible to scroll anymore in the given direction.

In iOS though is the fastest API that scrolls to the given element

1 Like