1
Good morning, I am developing a bot to capture certain information within the court site of a state, but according to the validation of the pages that is made per year I came across the following situation:
-some pages have a hidden link that redirects to a more detailed popup and others do not, thus 1 page with link and 1 page without link, for this I need to capture both information, as many as this link as the general.
Is there any condition of do while or if where I can validate the existence of this link? the snippet of the code 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);
display the sample html
– Leandro Angelo