Submitted by harrydev on Mon, 01/26/2015 - 01:47
In this tutorial, we will see taking a screen shot with test name and placing it in a folder by creating a folder with Test Class Name.
As we are taking screen shots on failure, we need to add logic in creating a screen shot and naming it with test name and place it in its test class name respectively.
We can get the test class name using 'result.getInstanceName()'. Test class name looks some thing like "com.pack.sample.HomePage". But we need to create a folder name with test class name i.e 'HomePage'.
Submitted by harrydev on Mon, 12/29/2014 - 00:59
We have discussed about simple way of taking a screen shot earlier. Now in this tutorial, we will see how to take screen shot ONLY for failed tests.
Submitted by harrydev on Sun, 03/02/2014 - 11:36
Its very important to take screenshot when we execute a test script. When we execute huge number of test scripts, and if some test fails, we need to check why the test has failed.
It helps us to debug and identify the problem by seeing the screen shot.
In selenium webdriver, we can take the screen shot using the below command.
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);