Zos*_*619 7 java testng selenium
我使用 java selenium 创建了一个自动化程序。我使用了 TestNG 框架。我想记录在脚本执行期间执行的屏幕的(视频),因此最好跟踪失败/通过的场景并查看执行过程。
任何人都可以帮我解决这个问题,如何在运行自动化套件执行期间记录屏幕。
请参阅此 API(Monte 库):http://www.seleniummonster.com/boost-up-your-selenium-tests-with-video-recording-capability/
这个链接:http://unmesh.me/2012/01/13/recording-screencast-of-selenium-tests-in-java/
示例代码(来自上面的链接):
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();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13557 次 |
| 最近记录: |