Html Agility Pack get all elements by class

前端 未结 5 1626
失恋的感觉
失恋的感觉 2020-12-04 10:48

I am taking a stab at html agility pack and having trouble finding the right way to go about this.

For example:

var findclasses = _doc.DocumentNode.D         


        
5条回答
  •  一生所求
    2020-12-04 11:05

    You can use the following script:

    var findclasses = _doc.DocumentNode.Descendants("div").Where(d => 
        d.Attributes.Contains("class") && d.Attributes["class"].Value.Contains("float")
    );
    

提交回复
热议问题