The basic rule of testing is to always take screenshot to base your claim. You can take screenshots at any stage of the test, but mostly, it is used for when a test fails and taking screenshots helps the analysis so we can see what went wrong during a test failure. The bugs you log should always have a screenshot attached to it. However, it is not necessary that screenshot should be taken only when you encounter a situation where expected result does not match the actual result. Screenshot are also taken as a proof that things are working fine. In this tutorial we will learn how to capture Screenshot in Selenium Webdriver using Java, i.e. TakesScreenshot class.