I trying to use webbrowser to navigate list of url and get list htmldocument and I use this my code:
WebBrowser webBrowser1 = new WebBrowser();
private void Form1_Load(object sender, EventArgs e)
{
string[] url = new string[] { @"http://x2.blogtruyen.com/2010/07/gto-shonan-14-days-chap-22.html", @"http://x2.blogtruyen.com/2010/07/gto-shonan-14-days-chap-23.html", @"http://x2.blogtruyen.com/2010/10/gto-shonan-14-days-chap-24.html" };
foreach (string item in url)
{
webBrowser1.Navigate(new Uri(item));
webBrowser1.ScriptErrorsSuppressed = true;
webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
}
}
void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (this.webBrowser1.ReadyState == WebBrowserReadyState.Complete)
{
string s = "";
HtmlDocument doc = webBrowser1.Document;
HtmlElementCollection images = doc.Images;
foreach (HtmlElement item in images)
{
s += item.GetAttribute("src") + "\r\n";
}
MessageBox.Show(s);
s = "";
}
}
But when I run my application, it's not work correctly!
My question: how to resolve this problem! Thank for advance!
Well, first "it's not work correctly" doesn't tell us anything about WHAT ISN'T WORKING.
Next, employing my psychic powers...
Good luck.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.