diff --git a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightInstance.cs b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightInstance.cs index bf58a5ac..95b88eee 100644 --- a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightInstance.cs +++ b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightInstance.cs @@ -150,17 +150,20 @@ public class PlaywrightInstance : IDisposable ResponseInMemory = args.ResponseInMemory }; + var html = await response.TextAsync(); if (response.Headers["content-type"].Contains("application/json")) { if (response.Status == 200 && response.Ok) - { - var json = await response.JsonAsync(); - result.ResponseData = JsonSerializer.Serialize(json); + { + if (!string.IsNullOrWhiteSpace(html)) + { + var json = await response.JsonAsync(); + result.ResponseData = JsonSerializer.Serialize(json); + } } } else { - var html = await response.TextAsync(); result.ResponseData = html; }