1
我使用C#窗口應用程序來獲取網頁HTML內容,但返回的內容未完成(新聞列表丟失,因爲它使用Java腳本加載)。我添加了一個webBrowser控件,並導航到我想要的內容的URL,並在documentDompleted事件我得到documentText缺少一些HTML標籤。我嘗試了所有的解決方案在stackoverflow,但他們失敗了。下面是代碼:完全加載後獲取頁面內容
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void buttonParse_Click(object sender, EventArgs e)
{
string url = textBoxURL.Text.Trim();
this.webBrowser1.Navigate(url);
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
string content = webBrowser1.DocumentText;
}
}
,這是我想獲得其內容的網址:
http://search.youm7.com/home/Index?allwords=%D8%B3%D8%AF%20%D8%A7%D9%84%D9%86%D9%87%D8%B6%D9%87
我使用的是Windows窗體應用程序,以獲取該頁面的HTML內容,我只可以使用WebBrowser控逆變事件。 – Abdelrahman