I am using jython based RF, it has argument that takes listener. The listener has endTest methods, here i am overloading the method to take screenshot whenever the keyword fails but screen shot is not appending to report. How can i do that?
How to customize if at all i have to?. I am currently using 2.8.5.
public class Listener
{
public void endTest( String name, Map attributes ) throws IOException, ScriptException
{
String status = attributes.get( "PASS" ).toString();
if( !status.equals( PASS ) )
{
try
{
File scrFile = ( ( TakesScreenshot )driver ).getScreenshotAs( OutputType.FILE );
FileUtils.copyFile( scrFile, new File( outputFolder + "/" + errorFile + ".png" ) );
}
catch ( Exception ex )
{
System.out.println( "Exception while taking and saving screenshot" );
ex.printStackTrace( System.out );
}
}
}