Validate hidden URL in html tables with C #

1

Good morning, I'm developing a bot to capture certain information within the court of accounts of a state, however according to the validation of the pages that is done per year I came across the following situation:

- some pages have a hidden link that redirects to a more detailed popup and others not, so there is a page with a link and a page without a link, so I need to capture both the information of that link and the way general.

Is there any condition of do while or if in which I can validate the existence of this link? the code snippet that validates the link is this:

Response itens1 = bot.Get("http://portaldocidadao.tce.sc.gov.br/" + html2.SelectSingleNode("//table[@id='de1']/tr[@class='sr']").Attributes["onclick"].Value.CopyBetween("location.href='", "'").Trim());
var html3 = itens1.Html();
Item itens = new Item();
itens.quantidade = html3.SelectNodes("//tr[@class='sr']/td")[3].SelectSingleNode("div").InnerText.ToDecimal();
itens.quantidade = html3.SelectNodes("//tr[@class='dr']/td")[3].SelectSingleNode("div").InnerText.ToDecimal();
/*validar valores unitários */
itens.valor_unitario = html3.SelectNodes("//tr[@class='sr']/td")[5].SelectSingleNode("div").InnerText.Trim().ToDecimal();
itens.valor_total = html3.SelectNodes("//tr[@class='sr']/td")[5].SelectSingleNode("div").InnerText.Trim().ToDecimal();
itens.descricao = html3.SelectNodes("//tr[@class='sr']/td")[1].SelectSingleNode("div").InnerText.Trim();
Documento.itens.Add(itens);
    
asked by anonymous 19.04.2018 / 13:19

0 answers