Scenario is that when i click start button starts this thread:
var t = new Thread(get_webbrowser_page);
t.SetApartmentState(ApartmentState.STA);
t.Start();
And start this function:
public void get_webbrowser_page()
{
WebBrowser browser = new WebBrowser();
browser.Navigate("http://www.google.com");
string htmla = "as";
browser.DocumentCompleted += (s, e) =>
{
var html = browser.DocumentText;
htmla = html.ToString();
};
MessageBox.Show("ASD=" + htmla);
}
My mission is to simulate a click on href element but i can't do it because DocumentText is always empty.
I've red this WebBrowser - empty DocumentText question but it doesn't works for me. Where I'm wrong?