protected File takeScreenshotInMemory(TakesScreenshot driver) { try { return driver.getScreenshotAs(FILE); } catch (Exception e) { printOnce("takeScreenshotAsFile", e); return null; } }
protected File takeScreenshotImage(TakesScreenshot driver, String fileName) { try { File scrFile = driver.getScreenshotAs(FILE); File imageFile = new File(reportsFolder, fileName + ".png"); copyFile(scrFile, imageFile); return imageFile; } catch (Exception e) { printOnce("takeScreenshotImage", e); return null; } }