From ed32c43121e640087b09d943ce97c71790f3ec8a Mon Sep 17 00:00:00 2001 From: Harsimranjeet Singh Date: Tue, 27 Aug 2024 19:30:24 +0530 Subject: [PATCH] added check for 0,0 viewport size --- .../Drivers/CoreDrivers/Web/Playwright/PlaywrightDriver.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightDriver.cs b/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightDriver.cs index b447b82fe7..66a804958d 100644 --- a/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightDriver.cs +++ b/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Playwright/PlaywrightDriver.cs @@ -487,7 +487,7 @@ private void ThrowIfClosed() } byte[] screenshot; - if (fullPage) + if (fullPage) { screenshot = await tab.ScreenshotAsync(); } @@ -1574,6 +1574,11 @@ public VisualElementsInfo GetVisualElementsInfo() public void ChangeAppWindowSize(int width, int height) { ThrowIfClosed(); + if (width <= 0 || height <= 0) + { + //for VRT action, it passes widht and height as 0 to maximize which causes issues with Playwright, so ignoring those + return; + } Size size = new(width, height); Task.Run(() => _browser.CurrentWindow.CurrentTab.SetViewportSizeAsync(size).Wait()).Wait(); }