0
<fieldset><b>&nbsp;</b><button id="submit" class="googleCheckPosButt" 
onclick="docSubmit()">CHECK</button></fieldset>
</form>

This is a source code of a webpage where I am trying to put data into a form and submit it. I can successfully enter data into the text fields of the page, but when the web page loads in a web browser it shows a script error and when I click on any of the buttons on the page, nothing works. I have hidden the error messages by adding:

webBrowser1.ScriptErrorsSuppressed = true;

theElementCollection = webBrowser1.Document.GetElementsByTagName("input");
foreach (HtmlElement curElement in theElementCollection)
{
    if (curElement.GetAttribute("id").Equals("submit"))
    {
        curElement.InvokeMember("click");                       
    }
}

Please Help me how can i enter data into the site with out getting script error messages

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122

1 Answers1

0

While you can use a browser control to do this type of automated form submission, I would instead recommend using something like http://htmlagilitypack.codeplex.com along with the example from HtmlAgilityPack Post Login to work it.

Community
  • 1
  • 1
Timmerz
  • 6,090
  • 5
  • 36
  • 49