How to Capture multiple screenshots (not overriding the previous one)through selenium webdriver using aShot class. I am able to run 2 test cases and can see screenshot is being captured for both of the test cases however screenshot only got copied in the folder for the current case.Below code i am using to take full screenshot using aShot class.
public static void captureFullPage() throws IOException
{
screenshotName = d.toString().replace(":", "_").replace(" ", "_")+ "PNG";
Screenshot screenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(1000)).takeScreenshot(driver);
String dest = System.getProperty("user.dir") + "\\TestOutput\\" + screenshotName;
ImageIO.write(screenshot.getImage(), "PNG", new File(dest));
//return dest;
}
I think you are overriding your first taken screenshot by the second one, so you need to define a different path/folder where you want to save your second screenshot, to keep both screenshots under the different names