c# - how to get multiple a tags within multiple divs in Html having same names with help of Html agility pack, -


<div class="itemmenu level1">     <a class="itemmenuname level1" href="http://www.shophive.com/apple/mac">         <span>macbook</span>         </a>     // here more divs in div submenu items , level1 div ends under them </div>  

i want href link in tag within div, code below

foreach (htmlagilitypack.htmlnode node in doc.documentnode.selectnodes("//div[@class='megnor-advanced-menu-popup_inner']")) {       foreach (htmlagilitypack.htmlnode node2 in node.selectnodes("./a[@class='itemmenuname level1']"))     {         console.writeline(node2.innertext + " ");         console.writeline(node2.getattributevalue("href", ""));     } 

i getting whole block of code first loop second loop giving me error of nullreference


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -