How to find the page height in an android native app

Is there any way can we find the page height of a page in android and iOS native apps.

Any help on this is highly regarded.

@swathi try:

        int w = driver.manage().window().getSize().getWidth();
        int h = driver.manage().window().getSize().getHeight();
1 Like

Thanks Aleksei for your reply.

I tried that one and it is giving the device height and width but I am looking for page height and width.

@swathi can you give screenshot any point what size needed?

You can call getSize on any element. Create an object for your “page” and call away.

@Aleksei My requirement is how can i know whether I scrolled to the bottom of the page.

As the page elements are dynamic ,I cant compare with the last element and I cant judge that i reached to the bottom of the page.For this I wanted to know the page height.getSize() gives the view port height and width but I need the height of the entire scrolling page.

@swathi the only way to do it is remember first or last available element on screen in scroll view. and after doing scroll check that element did change or not.

I am doing in the same way but the problem is how can i make sure that scrolling is working fine.
For the long pages which has scrolling ,I am asserting that the previous element in the page is not present after I scroll.In that way i am making sure that the page is scrolled.
But the problem is for the pages which does not have scroll,means single page.If I assert the same logic like checking the previous element and current element my testcase will fail.As there is no scroll on the page, my previous and current elements are same.
That is the reason if I know the page height then I can check whether I scrolled the entire page or not.

@swathi with android the height of scroll view is what you see on screen. So nothing will change after scroll done.

For example check the below site
http://www.abc.net.au/news/
in selenium we can get the page height of this entire page if we want instead of getting the view port height.
So I am looking for a similar method in appium for native apps.

@swathi if your app is NATIVE not webview your page height will never exceed display height. (maybe for espresso this is NOT true. but Appium does not work yet with espresso anyway)

I am able to swipe till the bottom of the page on android native app using this logic.
" the only way to do it is remember first or last available element on screen in scroll view. and after doing scroll check that element did change or not."
I am not able to apply the same logic for iOS native apps.Is there any solution for iOS native apps because the element is visible in iOS even though it is not in the view port.

I got the solution in iOS as well.Thanks for your help.

@swathi, What is the solution?