<div>
<pre>
<span class="attr">id:</span>
<span class="text">1</span>
<span class="attr">time:</span>
<span class="text">42</span>
<span class="attr">length:</span>
<span class="text">74</span>
<span class="attr">id:</span>
<span class="text">2</span>
<span class="attr">time:</span>
<span class="text">57</span>
<span class="attr">length:</span>
<span class="text">74</span>
</pre>
</div>
Here's a mockup of some HTML I'm working with. I'm trying to use XPATH to find the amount of time that is associated with id: 1, and only id: 1, not id: 2.
//span[@class = 'attr'][text()='id:']/following-sibling::span[1][text()='1']
correctly gets the '1' element for id for me, but my attempt to do
//span[@class = 'attr'][text()='id:']/following-sibling::span[1][text()='1']/following-sibling::span[1][text()='time:']/following-sibling::span[1]
in order to grab the number after time after id: 1 doesn't work for me. I need the xpath to identify only the times after a certain id, so using a single following id after the time element won't work for me, as it also needs to find the id. Is it even possible to do following-sibling twice/thrice in a row? Is there a better way to do this?