I am using Selenium to identify any HTML element that may have a specified value in any of its attributes. I was hoping that there would be some way in XPath to do this, but I haven't been able to find any answers yet.
Definition of XPath attribute. For finding an XPath node in an XML document, use the XPath Attribute expression location path. We can use XPath to generate attribute expressions to locate nodes in an XML document.
First, you have to transform HTML into xhtml if you want to apply xpath selections on it.
The xpath for selecting an (x)html element having a specified value in one of its attributes is:
//*[@*="specified value"]
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