1
Answer

Programmatically click link button

Photo of sudhir bharti

sudhir bharti

8y
2.8k
1

I need to click the download link in the below url programmatically through c#, is this possible?

http://secure.greenboxenergy.net/ab.aspx?ID=62

I have tried to use the htmlagility pack, here is my code, where I am able to find out the a link id, but don't know if i can click through the htmlaigility. Any ideas how to click, please share the code if possible.

HtmlWeb web = new HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = web.Load(url);
var inputForms = doc.DocumentNode.Descendants("input");
var hrefLinks = doc.DocumentNode.Descendants("a");
foreach (HtmlNode input in hrefLinks)
{
if (input.OuterHtml.Contains("ctl00_BodyContent_Html2Image"))
{
MessageBox.Show("Found It");
}
}

Answers (1)