隐式函数评估:线程中的webbrowser,body始终为null

时间:2014-11-22 21:03:25

标签: c# multithreading implicit

我试图在新线程(consoleApplication)中使用webbrowser获取网站内容,然后从中获取,然后转到另一个网站并返回第一个。我的代码:

   wb.Navigate("https://www.google.com");
    while (wb.ReadyState != WebBrowserReadyState.Complete){
         Application.DoEvents();
         Thread.Sleep(10);
    } 
    string content = wb.Document.Body.InnerText; <- here is error(error in screenshoot(regex is good))
//goto next website and get back to first saving all cookies

img

我的主题:

workerThread=new Thread(new ThreadStart(newWebBrowserStarter));
            workerThread.SetApartmentState(ApartmentState.STA);
            workerThread.Start();

有什么想法吗?

0 个答案:

没有答案