diff --git a/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/PageActionArgs.cs b/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/PageActionArgs.cs index 8bf09cb1..0698194e 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/PageActionArgs.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/PageActionArgs.cs @@ -21,4 +21,4 @@ public class PageActionArgs public DataFetched? OnDataFetched { get; set; } } -public delegate void DataFetched(string url, string data); +public delegate void DataFetched(string url, string postData, string responsData); diff --git a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightInstance.cs b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightInstance.cs index a1716929..ef487366 100644 --- a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightInstance.cs +++ b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightInstance.cs @@ -109,9 +109,9 @@ public class PlaywrightInstance : IDisposable { if (e.Headers.ContainsKey("content-type") && e.Headers["content-type"].Contains("application/json") && - e.Request.ResourceType == "fetch") + (e.Request.ResourceType == "fetch" || e.Request.ResourceType == "xhr")) { - Serilog.Log.Information($"fetched: {e.Url}"); + Serilog.Log.Information($"{e.Request.Method}: {e.Url}"); JsonElement? json = null; try { @@ -123,7 +123,7 @@ public class PlaywrightInstance : IDisposable { Serilog.Log.Warning($"Response status: {e.Status} {e.StatusText}, OK: {e.Ok}"); } - fetched(e.Url.ToLower(), JsonSerializer.Serialize(json)); + fetched(e.Url.ToLower(), e.Request?.PostData ?? string.Empty, JsonSerializer.Serialize(json)); } catch(Exception ex) {