Print screenshot

How to take screenshot for only failed test cases using selenium web driver ?

package SeleniumLearn.COM;
import org.testng.annotations.Test;
import org.openqa.selenium.TakesScreenshot;
import java.io.File;
import org.apache.commons.io.FileUtils; 
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.BeforeTest;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;

public class TakeScreenshot {

How to take Full page Screenshot using Selenium ?

package SeleniumLearn.COM;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test; //import com.thoughtworks.selenium.Selenium;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;

Subscribe to RSS - Print screenshot