scrape text from web with agility

时间:2019-04-17 01:22:10

标签: c# html-agility-pack

Having real trouble locating the text from this website with the node I've tried all sorts or xPaths inside the selectnodes brackets does anyone have any ideas?

 HtmlAgilityPack.HtmlWeb web = new HtmlAgilityPack.HtmlWeb();
        HtmlAgilityPack.HtmlDocument doc = web.LoadFromBrowser("https://app.box.com/s/v2l2cd1mwhemijbigv88nyfk592rjei0");
        HtmlNode[] nodes = doc.DocumentNode.SelectNodes("//@*[starts-with(local-name(),'bcpr9')]").ToArray();



        foreach (HtmlNode item in nodes)
            {
           textBox1.Text = item.InnerText;
            }

1 个答案:

答案 0 :(得分:0)

Your code will only put the text from the last node into the text box as you are overwriting it each loop of the for loop. Try this:

textBox1.Text += item.InnerText;