SELENIUM BASICS:


SELENIUM WEBDRIVER:


TESTNG:


REPORTS:


BUILD & CONTINUOUS INTEGRATION TOOLS:


CROSS BROWSER TESTING:


MOBILE TESTING:


AUTOMATION FRAMEWORKS:


API Testing:


INTERVIEW QUESTIONS:


SAMPLE RESUME:

Capture Screenshot in Selenium WebDriver using FileHandler Class

Are you wondering why FileUtils is not working to capture screenshot. Is your eclipse not showing any suggestion when you hover on FileUtils. Don’t worry. Its an update in Selenium. In the latest version of Selenium, FileHandler class is implemented to capture screenshot instead of FileUtils.

Here is a sample program to use FileHandler in a Selenium script to capture a screenshot.

Given a detailed explanation inside the program for your understanding.

We have to import package “org.openqa.selenium.io.FileHandler” to work with FileHandler class

Here is a sample program.

Before Selenium 3.6.0, Apache Commons Library comes along with Selenium. But in Selenium new versions from Selenium 3.6.0 onwards, we have to download it separately to use it in our project.

You can download it from https://commons.apache.org/

If you are using Maven Project, here is the dependency of Apache Commons Library

If you have any queries, please comment below.

Sharing is caring.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Get our latest blog posts delivered to your inbox

Subscribe and get popular blog posts about software testing industry.

Rajkumar

Leave a Comment