如何在硒的帮助下进行屏幕录像? [英] How to perform screen recording with the help of selenium?

查看:95
本文介绍了如何在硒的帮助下进行屏幕录像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想记录我的剧本.如何使用Selenium Webdriver记录它?

I want to record my script. How can I record it using selenium webdriver?

推荐答案

您可以为此目的使用Monte Media Library.下载MonteScreenRecorder.jar并将其添加到您的项目中.如下使用:

You can use Monte Media Library for this purpose. Download MonteScreenRecorder.jar and add it to your project. Use like this below:

         GraphicsConfiguration gc = GraphicsEnvironment//
        .getLocalGraphicsEnvironment()//
        .getDefaultScreenDevice()//
        .getDefaultConfiguration();





        ScreenRecorder 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, (int)24, FrameRateKey, Rational.valueOf(15),
        QualityKey, 1.0f,
        KeyFrameIntervalKey, (int) (15 * 60)),
        new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey,"black",
        FrameRateKey, Rational.valueOf(30)),
        null);

在开始实际测试之前,只需启动屏幕录像机:

Before starting your actual test begins just start your screen recorder:

 screenRecorder.start(); 

最后在测试结束时停止.

and finally stops when test ends.

这篇关于如何在硒的帮助下进行屏幕录像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆