I am trying to get the value of a nested div using HtmlAgilitypack
.my html code is like this :
here is my code :
var val = resultat1.DocumentNode.SelectSingleNode("//div[@class='journal-content-article']/div[@class='news_page max']/div[@class='news_page_wrapper']/div[@class='news_page_content']/div[@class='news_content']/div[@class='news_content_container']").InnerText;
I need the innertext of news_content_container
.but this line of code return Object reference not set to an instance of an object
This returns error:
var val = resultat1.DocumentNode.SelectSingleNode("//div[@class='journal-content-article']/div[@class='news_page max']").InnerText;
This returns value but not expected value:
var val = resultat1.DocumentNode.SelectSingleNode("//div[@class='journal-content-article']").InnerText;