In last post, we have learnt to scroll a web page by pixels. In this post, we will see how to scroll a web page , page by page.
What is page in Web page?
Follow below steps:
- Open browser and load url “http://www.makeseleniumeasy.com/“.
- Wait till page is loaded.
- Now press Key “Page Down” and notice how much page is scrolled down. You have scrolled web page by a page.
- If you keep pressing “Page Down” key, you will reach bottom of page.
- First we need to get page height of one page.
- Then we need to get how much is scroll-able height. Generally it will be “Height of a page* No of pages”.
- Now get number of pages. It will be number of times of pressing “Page Down” key to get bottom of page.
When you run the program, you will notice page is scrolled down page by page till it reaches to bottom of the web page.
That’s it guys in this post. We will see some more interesting thing about scroll in up coming posts.
If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.