I’m trying to get the first image from this site but I keep getting an error and can’t quite figure out why..
Here’s the code:
string pictureurl = webdoc.DocumentNode.SelectSingleNode("//div[2]/table[1]/tr/td/a").Attributes["href"].Value;
and the error is Object reference not set to an instance of an object.
Can anyone please tell me why? if I remove the above line it works fine..
Your xpath is not correct to get a img
please use this way