商品导入

This commit is contained in:
Haiping Chen 2024-12-24 21:22:17 +00:00
parent e8d182494a
commit bf22260f59
2 changed files with 23 additions and 1 deletions

View file

@ -14,6 +14,13 @@ public partial class PlaywrightWebDriver
{
var result = new BrowserActionResult();
var page = _instance.GetPage(message.ContextId);
if (page == null)
{
return new BrowserActionResult
{
IsSuccess = false
};
}
ILocator locator = page.Locator("body");
int count = 0;

View file

@ -1,10 +1,25 @@
using HtmlAgilityPack;
using System.Net.Http;
namespace BotSharp.Plugin.WebDriver;
public static class WebPageHelper
{
public static HtmlNode GetElement(string html, string selector)
{
var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(html);
return htmlDoc.DocumentNode.SelectSingleNode(selector);
}
public static HtmlNodeCollection GetElements(string html, string selector)
{
var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(html);
return htmlDoc.DocumentNode.SelectNodes(selector);
}
public static string RemoveElements(string html, string selector)
{
var htmlDoc = new HtmlDocument();