[英]Script error while loading url in web browser control?
<fieldset><b> </b><button id="submit" class="googleCheckPosButt"
onclick="docSubmit()">CHECK</button></fieldset>
</form>
這是網頁的源代碼,我試圖將數據放入表單中並提交。 我可以成功地在頁面的文本字段中輸入數據,但是當網頁在Web瀏覽器中加載時,它顯示腳本錯誤,並且當我單擊頁面上的任何按鈕時,沒有任何效果。 我通過添加隱藏了錯誤消息:
webBrowser1.ScriptErrorsSuppressed = true;
theElementCollection = webBrowser1.Document.GetElementsByTagName("input");
foreach (HtmlElement curElement in theElementCollection)
{
if (curElement.GetAttribute("id").Equals("submit"))
{
curElement.InvokeMember("click");
}
}
請幫助我如何在不獲取腳本錯誤消息的情況下將數據輸入站點
雖然您可以使用瀏覽器控件執行這種類型的自動表單提交,但我建議您使用http://htmlagilitypack.codeplex.com之類的內容以及HtmlAgilityPack登錄后的示例進行操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.