3
I wonder how many tags <a>
exist within a div
, but the Exception NullReferenceException
is fired when arriving on Xpath.
var baseURL = "AQUI VAI A MINHA URL";
var client = new HtmlWeb();
var pagina = client.Load(baseURL);
var quantidade = pagina.DocumentNode.SelectNodes("//*[@id='react - root']/section/main/article/div/div[1]/div[1]/a").Count;
He couldn’t get in the way or I’m doing something wrong?
I understand, this explained then. Why is he not finding anything? Inside div[1]/a I have three <a> tags and I generated this path in Chrome using the element inspector.
– Gabriel Bernardone
Then I can’t say.
– Maniero
Yeah, it’s really complicated. All right, thank you very much.
– Gabriel Bernardone
Do you know if this HTML is being generated dynamically by Javascript on the screen? Htmlagilitypack does not execute the snippets of Javascript code you receive from the request, so HTML generated by JS will not be captured by the library. If that’s it Anglesharp has support for a JS engine (only it’s not 100% functional either, but it’s worth a try).
– Gabriel Katakura