C# html agility pack get elements by class name

前端 未结 5 905
忘了有多久
忘了有多久 2021-01-04 05:33

I\'m trying to get all the divs that their class contains a certain word:

content1
5条回答
  •  借酒劲吻你
    2021-01-04 06:02

    I'm sure because there're multiple classes in your div, that doesn't work. You can try this instead:

    resultContent.DocumentNode.Descendants("div").Where(d => d.Attributes["class"].Value.Contains("hello"));
    

提交回复
热议问题