I need to register to a site programmatically and I used an object named webbrowser1
The problem is that there is some object with the same name in the web form like this

<p><input type="submit" value="Continue" [B]name="submit" [/B]style="width:250px;"></p>
<input style="font-size:8pt; background-color:#221e1f; color:#e7e7e9;" type="submit" [B]name="Submit"[/B] value="Login" />

so I can't use something like this code

HtmlElement submit = webBrowser1.Document.GetElementsByTagName("submit");

I tried this instead

HtmlElementCollection submits =webBrowser1.Document.GetElementsByTagName("submit");
            foreach (HtmlElement currentElement in submits)
            {
                string val2 = currentElement.GetAttribute("value").ToString();
                if (val2.ToString() == "Continue")
                {
                    currentElement.InvokeMember("click");
                }
            }

But I do not know where the code is wrong because it does not work

Recommended Answers

All 2 Replies

Do you still want to know how to do what you are trying to do?

Why you need to do this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.