0

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

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by GDICommander
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.