<li>
<button>
<span>software</span>
<value>high risk</value>
</button> <button>
<span>hardware</span>
<value>moderate risk</value>
</button> <button>
<span>software</span>
<value>low risk</value>
</button>
<button>
</li>
I have written
//*[contains(@value, 'moderate risk']//preceding::span
Tried with Chropath but it says "This element might be inside iframe from different src. Currently ChroPath doesn't support for them."
Since its a practice, I saved it as html file