我尝试使用下面的代码将失败测试的屏幕截图发送到 reportPortal,但它对我不起作用。有人可以在这里帮忙吗
public ReportPortalMessage failedScrenshot(String methodName)
{
ReportPortalMessage message = null;
String time = pg.subGrpUnique_monthdate();
File srcfile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
java.util.Date d= new java.util.Date();
try
{
org.apache.commons.io.FileUtils.copyFile(srcfile, new File("./ScreenShots/"+d.toString().replace(":", "_")+".png")); message = new ReportPortalMessage(srcfile, rp_message);
LOGGER.info("Screenshot taken.");
}
catch (IOException e)
{
e.printStackTrace();
LOGGER.info("Unable to take screenshot.");
}
LOGGER.info(message);
return message;
}