Button Click in webpage via HTMLagilitypack

buttonclick html-agility-pack vb.net

Question

I am trying to fillout particular form over webpage using HTMLagility pack, but I am stuck as How to click the button on form via HTMLAgility. I have seen other option like HTMLElement, but I am not much into it. below is link where one can have look http://www.moneycontrol.com/india/fnoquote/acc/ACC

in this page, I am able to select "STOCK" dropdown menu and Expiry dropdown by setting attributes. But I need to click the "SEARCH FUTURES" button.

Any help of kind will be absolutely thankful. All code should be explan in vb.net requested

Accepted Answer

You can't use the Html Agility Pack to click to click a button, nor do you want to. The easiest way to achieve what you are tying to do is install a tool that will view HTTP post parameters. I use fiddler, and you can download it here: http://www.telerik.com/download/fiddler. When you click the "Search Futures" button, here is the POST data that is sent:

instrument_type=FUTSTK&post_flag=true&see_all=&sc_id=MPS&short_name=Adani+Ports&user_sel_price=&stock_code=MPS&sel_exp_date=2014-02-26

If you look closery you can see "Adani Ports" and "2014-02-26". Those are the values from the the Stock and Expiry Date drop downs. Modify those two values to whatever you want, then send an HTTP POST from your app containing that post data.




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why