如何使用C#HtmlAgilityPack解析HTML表单中的输入类型
我有这些HTML表单,我试图在其中获取输入值如何使用C#HtmlAgilityPack解析HTML表单中的输入类型,c#,html,forms,C#,Html,Forms,我有这些HTML表单,我试图在其中获取输入值 <form action="/checkout/cart" method="POST" class="update-qty-form"> <div class="quantity num-selector"> <input type="tel" value="1" name="qty" maxlength="3" class="quantity-increment"> </di
<form action="/checkout/cart" method="POST" class="update-qty-form">
<div class="quantity num-selector">
<input type="tel" value="1" name="qty" maxlength="3" class="quantity-increment">
</div>
</form>
我们最近使用这段代码从属性中提取数据:
var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(@"<form action='/checkout/cart' method='POST' class='update-qty-form'><div class='quantity num-selector'><input type='tel' value='1' name='qty' maxlength='3' class='quantity-increment'></div></form>");
var value = htmlDoc.DocumentNode.SelectSingleNode("//input").Attributes["value"].Value;
var htmlDoc=new HtmlDocument();
htmlDoc.LoadHtml(@“);
var value=htmlDoc.DocumentNode.SelectSingleNode(//输入”).Attributes[“value”].value;
希望它有助于可能重复的
var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(@"<form action='/checkout/cart' method='POST' class='update-qty-form'><div class='quantity num-selector'><input type='tel' value='1' name='qty' maxlength='3' class='quantity-increment'></div></form>");
var value = htmlDoc.DocumentNode.SelectSingleNode("//input").Attributes["value"].Value;