From the reading I've done so far I don't think it's possible but in the off chance it is, here goes:
Given the following overly simplified HTML (based on HTML generated from a CMS, so no real control over it)
<div class="random">
<div class="random"> <-- This is the one I want
<div class="random">
<div class="random">
<span class="random">
<input id="experiment-randomnumbers-textinput-2">
</span>
</div>
</div>
</div>
</div>
I have hacked together the following XPath expression to get the node that I want:
//input[contains(@id,'experiments') and contains(@id,'textinput-2')]/parent::span/parent::div/parent::div/parent::div
The question is, is there a neater way of doing this? I'm assuming it can't be done in CSS?
Cheers
Rob