should help you out For the System.Windows.Controls.WebBrowser class you can use the Document property. Add mshtml reference to your project that should be available by right click on project and selecting Add Reference, then you should be able to cast it to mshtml.IHTMLDocument2
mshtml.IHTMLDocument2 htmlDoc = webBrowser.Document as mshtml.IHTMLDocument2;
// do something like find button and click
To fix this issue Main problem with your code is WebBrowser wrong using. WebBrowser supposed to be used for interactive web-browsing, during it user do some things in the internet. But in your case you are using WebBrowser just for the printing after downloading the html. This is wrong by two reasons:
this will help WebBrowser is specifically designed to be used from inside a windows forms project. It is not designed to be used from outside a windows forms project. Among other things, it is specifically designed to use an application loop, which would exist in pretty much any desktop GUI application. You don't have this, and this is of course causing problems for you because the browser leverages this for its event based style of programming.