接触Appium时间不长,以下是截图方法代码,做个笔记备忘。
//截图
public void test(WebDriver driver){
File screen = ((RemoteWebDriver) driver).getScreenshotAs(OutputType.FILE);
File screenFile = new File("d:\\screen.png");
try {
FileUtils.copyFile(screen,screenFile);
} catch (IOException e) {
e.printStackTrace();
}
}