Skip to main content

You are here

Automation Testing

Taking Screen Shot using Selenium WebDriver

The following code takes a screen shot of the website www.sojicity.com. First, the Firefox browser is opened, then the site is loaded. The screen shot is taken and stored in a folder on the C:logicandtricks. Ensure you edit the location for the screen shot file as you see fit on the line:

FileUtils.copyFile(screenshot, new File("c:\\logicandtricks\\screenshot.jpg"));

To run the program you need to have Selenium configured.

Have fun!

Premium Drupal Themes by Adaptivethemes