1

我正在尝试使用 microsoft 表达式编码器 SDK 录制屏幕视频。但它也会记录锁定 Windows 的屏幕(超时或 Win+L 后)。如何将 captureJob 绑定到 chrome/firefox 浏览器并仅捕获浏览器窗口?

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

0 回答 0