public static void ScreenShot(String path){
//获取screenshot文件
File screenShot = driver.getScreenshotAs(OutputType.FILE);
//文件copy到指定的文件夹
try {
FileUtils.copyFile(screenShot,new File(System.getProperty("user.dir")+"_"+driver.currentActivity()+"_"+path+"_"+getDatetime()+".jpg"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//获取系统时间
public static String getDatetime(){
SimpleDateFormat date = new SimpleDateFormat("yyyymmdd hhmmss");
return date.format(new Date());
}
appium截图函数
最新推荐文章于 2024-03-30 15:22:31 发布