How can I retrieve the attribute value using XPath?
To obtain the value of a node’s attribute, you can use the @ symbol followed by the attribute name. For example, suppose you have the following HTML code:
<div class="myDiv" id="myId">Hello World</div>
To obtain the class attribute value of a div node, you can use the following XPath expression:
//div/@class
This will return myDiv as the result.