一些快速搜索使我想到了这一点:
http://blogs.steeplesoft.com/posts/2012/grabbing-screenshots-of-failed-
selenium-tests.html
基本上,他建议创建一个JUnit4
Rule并将测试包装
Statement在他调用的try / catch块中:
imageFileOutputStream.write( ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES));
这对您的问题有用吗?



