<form method="post" action="/gp/item-dispatch/ref=olp_atc_new_2" class="a-spacing-none">
<input type="hidden" name="session-id" value="147-3113226-4993231">
<input type="hidden" name="qid">
<input type="hidden" name="sr">
<input type="hidden" name="signInToHUC" value="0" id="signInToHUC">
<input type="hidden" name="metric-asin.B011MYEMKQ" value="1">
<input type="hidden" name="registryItemID.1">
<input type="hidden" name="registryID.1">
<input type="hidden" name="itemCount" value="1">
<input type="hidden" name="offeringID.1" value="xXgcZtPBgpFHeUzpX2V7SNk9CfHhhXhyLioVQ%2FwdUcLYBorDSaBIDRa3rxB%2B2CLtApICpC4QCMcejhjG5ARwqRNSnlondz%2BxyqSxF1m7iiPyCS6Fab0EwYwZe0J1sAxYETAhIfWeye1fT2ySUEgi4pJTZvbJ27Qn">
<input type="hidden" name="isAddon" value="1">
<span class="a-declarative" data-action="olp-click-log" data-olp-click-log="{"subtype":"main","type":"addToCart"}">
<span class="a-button a-button-normal a-spacing-micro a-button-primary a-button-icon"><span class="a-button-inner"><i class="a-icon a-icon-cart"></i><input name="submit.addToCart" class="a-button-input" type="submit" value="Add to cart"><span class="a-button-text" aria-hidden="true">
Add to cart
<span class="a-offscreen"">from seller Lacey Lane and price $29.99</span>
</span></span></span>
</span>
</form>
</span></span></span>
</span>
</form>
多个form表单相同 唯一不同的是每一个表单的action的值不一样
<span class="a-offscreen"">from seller Lacey Lane and price $29.99</span>
这一个也不一样 求大神 这样的表单 在一个页面可能有好几十个 我想匹配一个 然后点击
这不是很简单,js提交不久行了
使用JS 组建一个form表单,把界面数据通过JS发送给服务器
获取表单遍历,对比action找到你需要提交的表单触发表单
https://www.cnblogs.com/pingming/p/4115222.html
提交表单
https://www.cnblogs.com/yuanjw/archive/2007/06/26/796009.html
思路是这样,有多个form, 要提交哪个form就调用哪个form的submit方法,示例
<!DOCTYPE html>
我看到form表单是个嵌套的,如果要嵌套别设置action,要不然会有问题。
想用js模拟提交可以动态设置action,这样只用一个form就可以动态提交不同的action,下载一个jquery.form.js,百度有教程。
foreach(HtmlElement e in webBrowser1.Document.Forms)
{
if((HTMLFormElement)(e)).Action="你要选择的form")
{
((HTMLFormElement)(e)).submit();
}
}