This might be a simple and stupid question but I can't seem to find anything on selecting a node that has multiple attribute. In my case it is a specific class and a specific style.
Here is a snippet from the HTML I am working with.
<div class="buying" style="padding-bottom: 0.75em;">
<span class="availGreen">Blah Blah</span><br /> Blah Blah Blah<b>Sold By</b>.
</div>
There are many different instances of the class "buying" but only one instance of the div that includes both the buying class and the style="padding-bottom: 0.75em attributes. I am trying to grab the text inside the tag.
Here is what I have tried but I got nowhere:
SelectSingleNode("//div[@class='buying'][@style='padding-bottom: 0.75em;']/b").InnerText;
And also:
SelectSingleNode("//div[@class='buying' @style='padding-bottom: 0.75em;']/b").InnerText;
Neither of these produced any results but I am not sure what else is correct.
Any help is much appreciated!
Try joining them with and
(I believe that's the correct XPath way of selecting multiple attributes):
SelectSingleNode("//div[@class='buying' and @style='padding-bottom: 0.75em;']/b").InnerText;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With