Trying to scrapping multiples divs with same name but getting null instead RRS feed

  • Question

  • User-1796025582 posted

    Hi I am try to scrap multiple divs using htmlagilitypack nugat pakge but i am getting null in the final step .I cant able to figure out the problem.

    I have installed both nuget pakges of Htmlagilitypack i mean simple nd for .netcore

    Here is the code that I am trying in my controller (ASP.NET MVC Core)

    public IActionResult Index()
    var html = @"https://www.indeed.com.pk/jobs?q=software+engineer&l=Rawalpindi";
    HtmlWeb web = new HtmlWeb();
    var htmlDoc = web.Load(html);
    var node3 = htmlDoc.DocumentNode.SelectNodes("//div[contains(@class,'jobsearch-SerpJobCard')]");
    //node3 coming out null
    ViewData["Data"] = node3;
    return View();

    Saturday, September 21, 2019 11:46 AM


  • User-17257777 posted

    Hi Ales02,

    I test your codes in ASP.NET Core MVC and everything works fine.

    Test Result:

    This my installed package:

    Best Regards,

    Jiadong Meng

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 23, 2019 5:41 AM