Tuesday 29 December 2015

snapshot for reporting

 // Function call when test step FAILS
    public static void takeSnapshot(String msg,int status,WebDriver driver)
    {
        universalImageCounter++;
            String tempImgFile=IMG_PATH_UNDER_PARENT+"screenshot_"+(universalImageCounter)+".png";           
            try
            {
                File srcFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
                FileUtils.copyFile(srcFile, new File(tempImgFile));
                addToReport("###"+msg, status);
            }
            catch(Exception ex)
            {
                    addToReport("Error ID 1: Issue while taking snapshot.",FAIL);
            }
    }

No comments:

Post a Comment