1 min readFeb 19, 2020
How to take screenshots in winapp driver .
It is same as the normal webdriver script . You can use dependency in your pom.xml or build.gradle https://mvnrepository.com/artifact/commons-io/commons-io
The code
@Testpublic void screenshot() throws IOException{// you need import org.apache.commons.io.FileUtils so add org.apache.commons.io dependencyFile scrFile=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);//Captures mean the folder in java project locationFileUtils.copyFile(scrFile, new File(System.getProperty("user.dir")+"\\test-output\\"+"\\Captures\\"+"myScreenshot"+".png"));System.out.println("myScreenshot.png is generated go to directory to check");}