0

I need to unit/integration test my web application using selenium so I need to record the screen. I have written it down in global setup and global tear down as:

    public void GlobalSetup()
            {
                SetupExtentReport();

                // Create a instance of ScreenCaptureJob
                PropertiesCollection.Recorder = new ScreenCaptureJob();

                // Specify the path & file name in which you want to save         
                PropertiesCollection.Recorder.OutputScreenCaptureFileName = @"C:\ScreenRecording.wmv";

                // Start the Screen Capture Job
                PropertiesCollection.Recorder.Start();

//remaining code
    }

and in tear down

    public void GlobalTearDown()
            {
                try
                {
                    //close extent reports
                    PropertiesCollection.ExtentReport.Flush();
                    PropertiesCollection.ExtentReport.Close();

                    //stop recorder
                    PropertiesCollection.Recorder.Stop();


                Console.WriteLine("Finished All Tests");
            }
}

But my test does not debug and this error comes in test explorer.

Could not load assembly 'Microsoft.Expression.Encoder version=4.0.0 ........ ' or one of its dependencies. An attempt was made to load a program with an incorrect format.

I have been using Expression Encoder assembly referenced from installed folder.

Note: My project is simple class library project

This is a question which I viewed but it did not help me: Could not load file or assembly 'Microsoft.Expression.Encoder'

I went through certain questions but in my case it's library project and cannot convert to 32-bit/64-bit since I am not on IIS.

CodeGenius
  • 514
  • 1
  • 6
  • 21

1 Answers1

1

I needed to change build platform target from "Any CPU" to "x86".

daw
  • 1,959
  • 1
  • 20
  • 25