The similar way to create screenshots and put them in some folder on your computer when you use selenium webdriver:
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);FileUtils.copyFile(scrFile, new File(imagePath + "imageName.png"));