I have an HTML file that looks like:
<div id="products">
<div class="product">
<span class="productheader">Product 1</span>
<input type="checkbox" />
</div>
<div class="product">
<span class="productheader">Product 2</span>
<div class="selected_value and_other value plus one value">
<input type="checkbox" checked="checked" />
</div>
</div>
<div class="product">
<span class="productheader">Product 3</span>
<span class="hidden">
<div class="selected_value and_other value">
<input type="checkbox" checked="checked" />
</div>
</span>
</div>
</div>
I'd like to have the value from header where:
- the input is "checked" --> div class from descendant contains "selected_value"
- but not hidden --> the selected is not part of span with class "hidden"
so, only the second productheader value (Product 2) should be the result.
How should the correct xpath look like?
Tried many things, but none works. Most closely:
//div[contains(@class, 'product')]//*[descendant::div[contains(@class ,"selected_value")]]
Problem is that this does not account that it may not be hidden!