【发布时间】:2016-08-12 19:06:34
【问题描述】:
我无法截取失败的屏幕截图。早些时候,在我的真实 iOS 设备上一切正常,但现在 - Appium 崩溃并且无法截屏,我无法弄清楚发生了什么。
Appium 日志:link here
Java 代码:
public void takeScreenShotOnFailure(ITestResult testResult, String name) throws IOException {
if (testResult.getStatus() == ITestResult.FAILURE) {
File scrFile = dr.getScreenshotAs(OutputType.FILE);
Date date = new Date();
SimpleDateFormat home = new SimpleDateFormat("dd.MM hh:mm:ss");
String homedate = home.format(date);
FileUtils.copyFile(scrFile, new File("test-output/screenshots/" + name + ".jpg"));
}
}
有什么想法吗?
【问题讨论】:
-
尝试将扩展名更改为 .png
-
Appium 在这一行崩溃:File scrFile = dr.getScreenshotAs(OutputType.FILE);
-
好吧,抱歉,当我运行量角器脚本和 appium 时,我遇到了和你一样的错误
-
虽然有同样的错误,但我们有两个不同的问题,可能是一般错误,不取决于屏幕截图或我的问题!
标签: java screenshot appium appium-ios