编程语言
首页 > 编程语言> > C#html敏捷包按类名获取元素

C#html敏捷包按类名获取元素

作者:互联网

我试图得到他们的类包含某个单词的所有div:

<div class="hello mike">content1</div>
<div class="hello jeff>content2</div>
<div class="john">content3</div>

我需要得到他们的类包含单词“hello”的所有div.
像这样的东西:

resultContent.DocumentNode.SelectNodes("//div[@class='hello']"))

我怎么能用敏捷包呢?

解决方法:

我知道了:

resultContent.DocumentNode.SelectNodes("//div[contains(@class, 'hello')]"))

标签:c,html-agility-pack,html
来源: https://codeday.me/bug/20190713/1449195.html