Screen recording of a test execution in selenium using JAVA

后端 未结 2 1046
广开言路
广开言路 2020-12-16 05:40

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 ex

2条回答
  •  無奈伤痛
    2020-12-16 06:45

    See this API (Monte Library): http://www.seleniummonster.com/boost-up-your-selenium-tests-with-video-recording-capability/

    and this link: http://unmesh.me/2012/01/13/recording-screencast-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();
    }
    

提交回复
热议问题