Quantcast
Channel: htmlagilitypack Forum Rss Feed
Viewing all articles
Browse latest Browse all 655

New Post: how find input of form in html with htmlagilitypack?

$
0
0
I have a program that you're using htmlagilitypack, which dll's I've added it into the html code of the program, we'll find a form to input.
So explain. Plan to tag form (form) after the detection of the input resulted in him somewhere to put them on the operation took place.
I put the code I ended up doing all the forms and all the cares in the input form, which is mine, and took the game without it's a and there's a I was doing here method.
I come from the input of each form and method which can be determined from the finished work are input form.
Please guide.

my code:
HtmlNodeCollection forms = doc.DocumentNode.SelectNodes("//form");
                    if (forms != null && forms.Count > 0)
                    {
                        FormMethod = forms[0].GetAttributeValue("method", "POST").ToUpper();
                        HtmlNodeCollection inputs = doc.DocumentNode.SelectNodes("//input");
                        foreach (HtmlNode input in inputs)
                        {
                            string TypeName = "";
                            if (input.Attributes.Contains("type"))
                                TypeName = input.Attributes["type"].Value.ToString();


                            if (
                                string.Compare(TypeName, "button", true) != 0 &&
                                string.Compare(TypeName, "image", true) != 0 

                                )
                            {
                                try
                                {
                                    InputsControls += input.Attributes["name"].Value.ToString() + "\r";
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }
                    }

Viewing all articles
Browse latest Browse all 655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>