From 51aa7a7e4b27fb5d1cae65a8e4203d786da8841d Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sun, 23 Mar 2025 13:03:45 +0300 Subject: [PATCH] [dotnet] [bidi] Decouple ScreenshotOrigin in BrowsingContext module --- .../BrowsingContext/CaptureScreenshotCommand.cs | 12 ++++++------ .../BiDi/BrowsingContext/BrowsingContextTest.cs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CaptureScreenshotCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CaptureScreenshotCommand.cs index bbede96ad4654..6b2ac687f5d45 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CaptureScreenshotCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CaptureScreenshotCommand.cs @@ -25,7 +25,7 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; internal class CaptureScreenshotCommand(CaptureScreenshotCommandParameters @params) : Command(@params, "browsingContext.captureScreenshot"); -internal record CaptureScreenshotCommandParameters(BrowsingContext Context, CaptureScreenshotOptions.ScreenshotOrigin? Origin, ImageFormat? Format, ClipRectangle? Clip) : CommandParameters; +internal record CaptureScreenshotCommandParameters(BrowsingContext Context, ScreenshotOrigin? Origin, ImageFormat? Format, ClipRectangle? Clip) : CommandParameters; public record CaptureScreenshotOptions : CommandOptions { @@ -34,12 +34,12 @@ public record CaptureScreenshotOptions : CommandOptions public ImageFormat? Format { get; set; } public ClipRectangle? Clip { get; set; } +} - public enum ScreenshotOrigin - { - Viewport, - Document - } +public enum ScreenshotOrigin +{ + Viewport, + Document } public record struct ImageFormat(string Type) diff --git a/dotnet/test/common/BiDi/BrowsingContext/BrowsingContextTest.cs b/dotnet/test/common/BiDi/BrowsingContext/BrowsingContextTest.cs index 40200ff415930..6fabd12e57b62 100644 --- a/dotnet/test/common/BiDi/BrowsingContext/BrowsingContextTest.cs +++ b/dotnet/test/common/BiDi/BrowsingContext/BrowsingContextTest.cs @@ -259,7 +259,7 @@ public async Task CanCaptureScreenshotWithParameters() { var screenshot = await context.CaptureScreenshotAsync(new() { - Origin = CaptureScreenshotOptions.ScreenshotOrigin.Document, + Origin = ScreenshotOrigin.Document, Clip = new BoxClipRectangle(5, 5, 10, 10) }); @@ -272,7 +272,7 @@ public async Task CanCaptureScreenshotOfViewport() { var screenshot = await context.CaptureScreenshotAsync(new() { - Origin = CaptureScreenshotOptions.ScreenshotOrigin.Viewport, + Origin = ScreenshotOrigin.Viewport, Clip = new BoxClipRectangle(5, 5, 10, 10) });