Hi,
Hope this helps.
You can create a screenshot function as below, very simple.
Then create a File Location and copy your file to that location.
Then convert the image to JPG or whichever format your prefer.
Then while you at it, prefix the filename with a TimeStamp to keep it unique.
public void takeScreenShot (WebDriver iwebdriver, String pathToFile, String sTitle) throws IOException {
String formatPNG = "png";
iwebdriver .manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
TakesScreenshot iCapScreens = (TakesScreenshot)
iwebdriver ;
File screenShotFile = iCapScreens.getScreenshotAs(OutputType.FILE);
iwebdriver .manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
Let me know it this is helpful.
Regards,
Riidonesh.