I have the following simplified HTML from a webpage...
<div class="row import-entity">
<div class="col-md-11">
<div class="row">
<div class="col-md-3">
<span class="mandatory"></span>
</div>
<div class="col-md-3">
<input id="ImportTemplateEntities_2918.Header" type="hidden"></input>
<input id="ImportTemplateEntities_5923.Header"></input>
</div>
<div class="col-md-3">
<input id="ImportTemplateEntities_1234.Column"></input>
</div>
<div class="col-md-3"></div>
</div>
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-3">
<input id="ImportTemplateEntities_9182.Header" type="hidden"></input>
<input id="ImportTemplateEntities_2834.Header"></input>
</div>
<div class="col-md-3">
<input id="ImportTemplateEntities_1243.Column"></input>
</div>
<div class="col-md-3"></div>
</div>
</div>
</div>
With a requirement for the following XPath selection criteria...
- An input tag that is within a col-md-3 div that is immediately after a col-md-3 div that contains a span with class = mandatory
- input tag shouldn't be hidden
The following element from the HTML above matches the search criteria
<input id="ImportTemplateEntities_5923.Header"></input>
(Note that the numerical value in the ID is assigned dynamically, and won't be known to me when searching the document.)
Before adding any sort of preceding sibling check this is what I have....
//input[contains(@id,'ImportTemplateEntities')][contains(@id,'Header')][not(contains(@type,'hidden'))]
How would I edit this to add a condition for checking whether the preceding sibling div contains a span with class = mandatory?