HtmlAgilityPack is there a way to check if the node exists on the webpage before selecting the node ?
While running my program, if the node doesn't exist at all on the page, I am getting a null exception error message.
I don't want to use
If firsttag(0).InnerText IsNot Nothing Then
as by using this, the program is already trying to get the value of the node.
I would like to scan the webpage first to see if the node exists
Dim firsttag As HtmlAgilityPack.HtmlNodeCollection = docnews.DocumentNode.SelectNodes("//div[(@class='byline')]")
Is there anything like
if firsttage(0) search does not exist then Continue For Else
Check whether firstTag returns
Nothing or if it returns an empty list:
If (firstTag IsNot Nothing and firstTag.Any() and firstTag.First().InnerText IsNot Nothing Then