From 7571512e0d67ee9e8680a92af83b0e0192576998 Mon Sep 17 00:00:00 2001 From: Visagan Guruparan <103048@smsassist.com> Date: Mon, 10 Mar 2025 15:52:43 -0500 Subject: [PATCH] Update headless setting for Playwright --- .../Drivers/PlaywrightDriver/PlaywrightInstance.cs | 6 +++++- .../BotSharp.Plugin.WebDriver/Functions/OpenBrowserFn.cs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightInstance.cs b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightInstance.cs index 4c65aa32..9f830f2e 100644 --- a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightInstance.cs +++ b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightInstance.cs @@ -33,9 +33,13 @@ public class PlaywrightInstance : IDisposable public async Task GetContext(string ctxId) { + var headless = true; +#if DEBUG + headless = false; +#endif if (!_contexts.ContainsKey(ctxId)) { - await InitContext(ctxId, new BrowserActionArgs()); + await InitContext(ctxId, new BrowserActionArgs() { Headless = headless }); } return _contexts[ctxId]; } diff --git a/src/Plugins/BotSharp.Plugin.WebDriver/Functions/OpenBrowserFn.cs b/src/Plugins/BotSharp.Plugin.WebDriver/Functions/OpenBrowserFn.cs index 6a5a1ac1..ed1c7398 100644 --- a/src/Plugins/BotSharp.Plugin.WebDriver/Functions/OpenBrowserFn.cs +++ b/src/Plugins/BotSharp.Plugin.WebDriver/Functions/OpenBrowserFn.cs @@ -29,9 +29,13 @@ public class OpenBrowserFn : IFunctionCallback ContextId = convService.ConversationId, MessageId = message.MessageId }; + var headless = true; +#if DEBUG + headless = false; +#endif var result = await _browser.LaunchBrowser(msgInfo, new BrowserActionArgs { - Headless = false + Headless = headless }); result = await _browser.GoToPage(msgInfo, new PageActionArgs {