Agility newbie here. Given input text:
<html>
... Lots of html here...
<label class="list_item_title">Yes</label><br /><br />
<div class="list_item">
<div style="width:425px;" class="left"><a href="/xyz">HIT1</a> (2012)</div>
<div style="width:190px;" class="right"></div>
</div>
<div class="list_item">
<div style="width:425px;" class="left"><a href="/abc">HIT2</a> (2012)</div>
<div style="width:190px;" class="right"></div>
</div>
<label class="list_item_title">No</label><br /><br />
<div class="list_item">
<div style="width:425px;" class="left"><a href="/xyz">IGNORE</a> (2012)</div>
<div style="width:190px;" class="right"></div>
</div>
... Lots of html here...
</html>
I want to get HIT1 & HIT2.
Basically the algorithm is to find the innerText of all A after the label node (class=”list_item_title”) where innerText=”Yes”
This XPath expression works for your example:
It looks for all
awhose first precedinglabelcontainsYesand returns their text().