Venkat
Venkat

Reputation: 603

Selenium to record browser actions as video

I wrote a selenium code to run automation in webpage via Firefox I need to record the browser actions like a visual Is there any way to record the screen on firefox as a video using addons or any other. I am using firefox version 34

Upvotes: 0

Views: 4003

Answers (2)

Ruby Beginner
Ruby Beginner

Reputation: 46

http://learnseleniumtesting.com/recording-selenium-test-execution/

using System;
.
.
using OpenQA.Selenium;
.
.
using Microsoft.Expression.Encoder.ScreenCapture;
using System.Drawing;
using Microsoft.Expression.Encoder.Profiles;
using Microsoft.Expression.Encoder;

namespace FRAMEWORK
{
    //Call this method in setup method.   
    public static void StartRecordingVideo()
    {
        //Provide setting in config file if you want to do recording or not.
        if (testEInfo.isRecording)
        {
            job = new ScreenCaptureJob();
            job.CaptureRectangle = Screen.PrimaryScreen.Bounds;
            job.ShowFlashingBoundary = true;
            //provide the location where you want to save the recording.
            job.OutputPath = AutomationLogging.newLocationInResultFolder;
            job.Start();
        }
    }
}

Upvotes: -1

Anaxi
Anaxi

Reputation: 316

You can include it in your test. Here is an example for C#. To make this work, you need to install Microsoft Expression Encoder and add the reference to your project

using Microsoft.Expression.Encoder.ScreenCapture;

    string timestamp = DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss");
    ScreenCaptureJob vidrec = new ScreenCaptureJob();
    vidrec.OutputScreenCaptureFileName = @"C:/yourPathToSaveFile/yourFilename " + timestamp + ".wmv";
    vidrec.Start();

// your test

vidrec.Stop();

Upvotes: 5

Related Questions