In the process of crawling, often encounter the script Error prompt window.
There are many solutions to this error on the Internet.
Then finally the test was successful. The implementation is as follows:
# # This way set the suppression of script errors to true.
This.webBrowser1.ScriptErrorsSuppressed = true;
this.webBrowser1.DocumentCompleted + = webbrowser1_documentcompleted;
private void Webbrowser1_documentcompleted (object sender, WebBrowserDocumentCompletedEventArgs e)
{
# # Sets the processing of document window errors.
This.webBrowser1.Document.Window.Error + = Onwebbrowserdocumentwindowerror;
}
<summary>
Handling errors in the Web browser
</summary>
<param name= "Sender" ></param>
<param name= "E" ></param>
private void Onwebbrowserdocumentwindowerror (object sender, Htmlelementerroreventargs e)
{
E.handled = true;
}
Only this three strokes, get rid of the annoying Script error window, finally no longer pop up.