2015-04-02 52 views
0

我编写了一个selenium代码来通过Firefox在网页上运行自动化操作 我需要记录浏览器的操作,比如视觉 有没有什么方法可以使用插件将Firefox上的屏幕记录为视频?任何其他。我正在使用firefox版本34Selenium将浏览器操作记录为视频

+0

共享代码。还有哪些添加你正在使用? – 2015-04-02 05:07:49

+0

目前,我没有使用添加?我只是采取截图 – Venkat 2015-04-02 05:28:20

回答

5

您可以将它包含在您的测试中。这里是一个C#的例子。为了使这项工作,你需要安装Microsoft Expression Encoder中和参考与你写问题添加到您的项目

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(); 
+0

我有两个问题。我目前正在运行测试(其他系统)通过集线器和5个浏览器打开并行,我想记录每个浏览器的视频 – Venkat 2015-04-02 10:00:33

-1

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(); 
     } 
    } 
}