From 78f5cd1751ecea360fb4ae8bdbc2c6982d569d8d Mon Sep 17 00:00:00 2001 From: Haiping Chen Date: Sun, 20 Oct 2024 15:24:21 +0000 Subject: [PATCH] category --- .../Browsing/Models/ElementLocatingArgs.cs | 3 +++ .../Browsing/Models/WebPageResponseFilter.cs | 3 +++ .../PlaywrightWebDriver.LocateElement.cs | 10 +++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/ElementLocatingArgs.cs b/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/ElementLocatingArgs.cs index 53d72520..b50f2366 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/ElementLocatingArgs.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/ElementLocatingArgs.cs @@ -1,5 +1,8 @@ +using System.Diagnostics; + namespace BotSharp.Abstraction.Browsing.Models; +[DebuggerStepThrough] public class ElementLocatingArgs { [JsonPropertyName("match_rule")] diff --git a/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/WebPageResponseFilter.cs b/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/WebPageResponseFilter.cs index d9561847..54951115 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/WebPageResponseFilter.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Browsing/Models/WebPageResponseFilter.cs @@ -1,5 +1,8 @@ +using System.Diagnostics; + namespace BotSharp.Abstraction.Browsing.Models; +[DebuggerStepThrough] public class WebPageResponseFilter { public string Url { get; set; } = null!; diff --git a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.LocateElement.cs b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.LocateElement.cs index a39da9c0..ff43864e 100644 --- a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.LocateElement.cs +++ b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.LocateElement.cs @@ -128,7 +128,15 @@ public partial class PlaywrightWebDriver } else { - result.Selector = locator.ToString().Split("Locator@").Last(); + foreach (var element in await locator.AllAsync()) + { + var html = await element.InnerHTMLAsync(); + _logger.LogWarning(html); + // fix if html has & + result.Body = HttpUtility.HtmlDecode(html); + break; + } + result.IsSuccess = true; } }