How to link ScreenCaptureJob to browser window?

I'm trying record screen video using microsoft expression encoder SDK. But it also records screen of locked Windows (after timeout or Win+L). How to tether captureJob to chrome/firefox browser and capture only browser window?

using Microsoft.Expression.Encoder.ScreenCapture;

[Binding]
public sealed class CommonWebActions
{
    [BeforeScenario]
    public static void Initialize(TestContext testContext)
    {
        Driver = new ChromeDriver();
        Driver.Manage().Window.Maximize();

        if (VideoRecorder.Status != RecordStatus.Running)
        {
            TestRecordName = "Test.wmv";
            VideoRecorder.OutputScreenCaptureFileName = TestRecordName;
            VideoRecorder.Start();
        }
    }

    [AfterScenario]
    public static void CleanUp()
    {
        VideoRecorder.Stop();
        if (_testContext.CurrentTestOutcome == UnitTestOutcome.Passed || 
            _testContext.CurrentTestOutcome == UnitTestOutcome.Inconclusive)
        {
            File.Delete(TestRecordName);
        }

        Driver.Quit();
    }
}

Upvotes: 1

Views: 235

Answers (0)

Related Questions