WebBrowser control - Get element By type?

后端 未结 3 1104
长情又很酷
长情又很酷 2020-12-19 15:49

I need to get a element by type in C# the HTML looks like this:


         


        
3条回答
  •  星月不相逢
    2020-12-19 16:14

    Well a button with no id or name like that will submit whatever form it is contained within - if you know the HTML, then does the form have an id? If so you can find the form by it's id and call it's submit method.

    In fact you would probably be better to find out all the fields of that form and then just POST to it yourself:

    var inputs = new NameValueCollection();
    inputs.Add("field1", "value1");
    inputs.Add("field2", "value2");
    inputs.Add("field3", "value3");
    
    System.Net.WebClient Client = new WebClient();
    Client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
    byte[] POSTResultData = Client.UploadValues(postUrl, inputs);
    

提交回复
热议问题