Part 10: Usages Of Javascripts In Selenium: How To Capture Screenshot Of Entire Web Page

Hello Folks,

When we capture screenshot using “TakesScreenshot” interface in selenium webdriver, it captures only visible area of webpage in browser, not entire web page. Sometimes, you need to capture entire web page for test result proof or for validation at later stage. In this post, I will explain how can we capture a web page, page by page in selenium webdriver using javascript methods.

In last post, we have learnt how to scroll a web page, page by page. We will use same concept and will call screen capture method after each scroll.

Java Code:

Output:
After running program successfully, you will see screenshots at specified location as below:

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.
#ThanksForReading
#HappySelenium

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 4+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went throw so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning