2015-04-02 44 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(); 
     } 
    } 
}