How to take a Screenshot in Selenium WebDriver


Screenshots are important to analyse the execution failures. It helps an automation tester to analyse what went wrong during execution. As one of the best automation testing services companies, we have also faced several challenges when troubleshooting test automation failures. Screenshot is a great reference document to recheck how the functionalities behaved previously and to identify false negatives from script failures.

In this blog article, we would like to share how to take screenshot in Selenium WebDriver using various commands.

Full Page Screenshot

In Selenium 4, you can take full page screenshot. This feature is very helpful to investigate failures in detail.

Note: As of now, full page screenshot works only for Firefox driver.

Element Screenshot

Sometimes you may need screenshot only for a specific element instead of capturing the entire page.

Full Page Screenshot using aShot

aShot is a WebDriver Screenshot utility. It takes a screenshot of the WebElement on different platforms (i.e. desktop browsers, iOS Simulator Mobile Safari, Android Emulator Browser).

Viewport Screenshot


Leave a Reply

Your email address will not be published. Required fields are marked *