This project has moved and is read-only. For the latest updates, please go here.

loading html, clicking radiobutton and saving the new page to the hdd

Topics: Developer Forum
Jul 22, 2010 at 12:52 PM
I m new with html agility pack. I have a problem as follows: I have a console app. I need to have the page with a url i do that : HtmlWeb hw = new HtmlWeb(); //string url = @""; HtmlDocument doc = hw.Load(url); then in that page must click a radiobutton (directing a new page) The problem is that i cant make the program click a radiobutton in that page, and take the directed page by the radiobutton. at last i need to save the page in my hdd smwhere. Can anybody help?
Jul 22, 2010 at 1:34 PM
HTML Agility Pack is not a browser engine, it knows nothing of javascript, nor CSS. It simply parses the html into a data form. It cannot and will never do any sort of interactivity like that. To do what you need to do you will probably need to create a windows program that hosts the Web Browser control which brings the IE engine into your program where you can inject some JS to do the click.
Jul 23, 2010 at 11:43 AM

ok well, I have HtmlDocument doc = hw.Load(url),  how do i add <script type="text/javascript" src="jscript.js"></script> in <head> tags? could this solve my problem? Thank you very much

Aug 12, 2010 at 10:28 AM

You need parse <form> tag and compose new url. You can read for example:

If you composing GET request, you will get something like this url:

But if you must POST on the page, then you can do like that: