如何以 Html 形式复制操作值

How can I copy the Action value in an Html form

我希望能够得到 "The Merinda Flat Sandal In Silver" 这是一种形式 这是代码 <p class="product_note">The Merinda Flat Sandal In Silver</p> 我想将它复制到下面代码中的字符串,但要获取文本而不是值


string id = "https://www.factory54.co.il/products/Logo-canvas-sneakers-in-White-No-167";
            Console.WriteLine(HtmlAgi(id)); 

        }
        public static string HtmlAgi(string url)
        {

            var Webget = new HtmlWeb();
            var doc = Webget.Load(url);
            HtmlNode ourNode = doc.DocumentNode.SelectSingleNode(("//form[@class]"));

            if (ourNode != null)
            {


                return ourNode.GetAttributeValue("class", "");

            }
            else
            {
                return "not fount";
            }

        }```
```<div class="produtshow clearfix">
                                                                                            <h1 id="manufacturer_header"><a href="https://www.factory54.co.il/designers/stuart-weitzman" title="Stuart Weitzman">Stuart Weitzman</a>                                    <p class="product_note">The Merinda Flat Sandal In Silver</p>
                                </h1>

</div>```
And here is where the text is in the html file (this is located in a form)

将 SelectSingleNode 行更改为:

HtmlNode ourNode = doc.DocumentNode.SelectSingleNode(("//form[@action]"));

要读取多个 for 元素,请使用:

static void Main(string[] args)
{
    string id = "https://www.factory54.co.il/products/Logo-canvas-sneakers-in-White-No-167";
    HtmlAgi(id);
}

public static void HtmlAgi(string url)
{
    var Webget = new HtmlWeb();
    var doc = Webget.Load(url);
    var ourNodes = doc.DocumentNode.SelectNodes(("//form[@action]"));

    foreach (var node in ourNodes)
        Console.WriteLine(node.GetAttributeValue("action", ""));
}  

由您决定您想要哪一个。