简体   繁体   English

在Web浏览器控件中加载url时脚本错误?

[英]Script error while loading url in web browser control?

<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. 我可以成功地在页面的文本字段中输入数据,但是当网页在Web浏览器中加载时,它显示脚本错误,并且当我单击页面上的任何按钮时,没有任何效果。 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 请帮助我如何在不获取脚本错误消息的情况下将数据输入站点

虽然您可以使用浏览器控件执行这种类型的自动表单提交,但我建议您使用http://htmlagilitypack.codeplex.com之类的内容以及HtmlAgilityPack登录后的示例进行操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM