首页
社区
课程
招聘
未解决 [求助]C#webbrowser 多个form表单选择一个提交 10.00雪花
发表于: 2018-2-14 04:28 2739

未解决 [求助]C#webbrowser 多个form表单选择一个提交 10.00雪花

2018-2-14 04:28
2739

 <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="{&quot;subtype&quot;:&quot;main&quot;,&quot;type&quot;:&quot;addToCart&quot;}">
                             <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>


这个是其中一个form表单  还有相同的N个form表单  其中不同的  是  action的值  还有 <span class="a-offscreen"">from seller Lacey Lane and price $29.99</span>内容也是不一样的  其他的 都不一样   如何选择其中的一个来  进行 点击呢


[课程]Android-CTF解题方法汇总!

收藏
免费 0
支持
分享
最新回复 (3)
雪    币: 238
活跃值: (375)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
方便点 的话 就是执行JS了。
C# 可以用各种CEF的实现 例如啥cefsharp?
可以注册扩展在页面加载后执行JS脚本。

例如看雪这个页面上就有几个FORM。可以使用:

引用

var aa=document.getElementsByTagName("form");

for (var i=0;i<aa.length;i++)

{

var e=aa[i]

console.log(e.action)

--判断下action 然后。。。想干嘛干嘛

}



2018-2-14 12:15
0
雪    币: 4
活跃值: (531)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
不行呢,亲
2018-2-14 12:58
0
雪    币: 2
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4

form提交方式


表单可实现无刷新页面提交,无需页面跳转,如下,通过一个隐藏的iframe实现,form表单的target设置为iframe的name名称,
form提交目标位当前页面iframe则不会刷新页面

<form action="/url.do" method="post" target="targetIfr">
<input type="text" name="name"/>
</form>   
<iframe name="targetIfr" style="display:none"></iframe> 
              

通过type=submit提交

一般表单提交通过type=submit实现,input type="submit",浏览器显示为button按钮,通过点击这个按钮提交表单数据跳转到/url.do

<form action="/url.do" method="post">
   <input type="text" name="name"/>
   <input type="submit" value="提交">
</form>
              

js提交form表单

js事件触发表单提交,通过button、链接等触发事件,js调用submit()方法提交表单数据,jquery通过submit()方法

<form id="form" action="/url.do" method="post">
   <input type="text" name="name"/>
</form>
              

js: document.getElementById("form").submit();
jquery: $("#form").submit();

ajax异步提交表单数据

采用ajax异步方式,通过js获取form中所有input、select等组件的值,将这些值组成Json格式,通过异步的方式与服务器端进行交互,
一般将表单数据传送给服务器端,服务器端处理数据并返回结果信息等

<form id="form"  method="post">
   <input type="text" name="name" id="name"/>
</form>
  var params = {"name", $("#name").val()}
 $.ajax({
      type: "POST",
      url: "/url.do",
      data: params,
      dataType : "json",
      success: function(respMsg){
      }
   });
              

页面无跳转

如果通过form表单提交请求服务端去下载文件,这时当前页面不会发生跳转,服务端返回void,通过response 去写文件数据,
页面会显示下载文件。

<form action="/url.do" method="post">
   <input type="text" name="name"/>
   <input type="submit" value="提交">
</form>

@RequestMapping(value = "/url")
    public void exportFile(HttpServletRequest req, HttpServletResponse response, String rptId)
            throws Exception {
        OutputStream out = null;
        try {
            String rptName = "file";
            String fileName = new String((rptName + excelAble.getFileSuffix()).getBytes("GBK"),
                    "8859_1");
            response.reset();
            response.setContentType("application/octec-stream");
            response.setHeader("Content-disposition", "attachment; filename=" + fileName);
            out = response.getOutputStream();
            excelAble.exportFile(out);
        } catch (Exception e) {
            logger.error(e);
        } finally {
            if (out != null) {
                out.close();
            }
        }
    }
              

form表单上传文件

使用form表单进行上传文件需要为form添加enctype="multipart/form-data" 属性,除此之外还需要将表单的提交方法改成post,
如下 method="post", input type的类型需要设置为file

 <form action="/url.do" enctype="multipart/form-data" method="post">
     <input type="file" name="name"/>
     <input type="submit" value="提交">
   </form>
              

2018-2-19 13:42
0
游客
登录 | 注册 方可回帖
返回
//