使用JAVA在硒中进行测试执行的屏幕录制 [英] Screen recording of a test execution in selenium using JAVA
问题描述
我使用java selenium创建了一个自动化程序。我使用了TestNG框架。
我想记录在脚本执行期间执行的屏幕(视频),因此最好跟踪失败/通过的场景并查看执行过程。
I have created an automation program using java selenium.I have used TestNG framework. I want to record (video) of the screen those are getting executed during the script execution so it is better to track the failed/passed scenario and view the execution process.
任何人都可以帮我解决这个问题,如何在运行自动化套件执行期间记录屏幕。
Can any one help me with this, how to record the screen during running the automation suite execution.
推荐答案
参见此API(蒙特图书馆): http:/ /www.seleniummonster.com/boost-up-your-selenium-tests-with-video-recording-capability/
See this API (Monte Library): http://www.seleniummonster.com/boost-up-your-selenium-tests-with-video-recording-capability/
此链接: http://unmesh.me/2012/01/ 13 / record-of-selenium-tests-in-java /
示例代码(来自上面的链接):
Example Code (from above links):
public void startRecording() throws Exception
{
GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
this.screenRecorder = new ScreenRecorder(gc,
new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI),
new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,DepthKey, 24, FrameRateKey, Rational.valueOf(15),QualityKey, 1.0f,KeyFrameIntervalKey, 15 * 60),new Format(MediaTypeKey,MediaType.VIDEO, EncodingKey, "black",FrameRateKey, Rational.valueOf(30)),null);
this.screenRecorder.start();
}
public void stopRecording() throws Exception
{
this.screenRecorder.stop();
}
这篇关于使用JAVA在硒中进行测试执行的屏幕录制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!