Roger Williams

Roger Williams

  • NA
  • 3
  • 1.8k

I'm confused about this, how come it's not filling the web form

Apr 15 2012 9:34 PM

 I made a button that if clicked, it would get the element ID of an HTML button which is "ContinueButton" and then it would invoke a click on it. Just as coded below. So basically, it will click this HTML button and it would eventually lead to the next HTML page.

   

private void button11_Click(object sender, EventArgs e)
        {

            webBrowser1.Document.GetElementById("ContinueButton").InvokeMember("Click");

Now, after the next HTML page has loaded, it contains a web form. This web form has an element ID by "secretnumber."

I made a code below and it should fill this web form.


            webBrowser1.Document.GetElementById("secretnumber").SetAttribute("value", "320");

        }

However, the program stopped and it didn't fill the web form ("secretnumber"). Please help me.

I added this code too but it didn't seem to work.

while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
            {
                Application.DoEvents();
            }


Answers (2)