html - Finding sibling after matching node text using XPath -


consider following html.

<div class="block table__responsive-body" id="review_2">     <div class="row">         <div class="small-4 columns hide-for-large-up">             <strong>betyg</strong>         </div>         <div class="small-8 columns table__responsive-body-content">5<p>             <strong>skapades den: </strong>28 jun 09:44</p>         </div>     </div>      <div class="row">         <div class="small-4 columns hide-for-large-up">             <strong>produkt</strong>         </div>         <div class="small-8 columns table__responsive-body-content">             <a href="/products/9">volvo v50</a>         </div>     </div>      <div class="row">         <div class="small-4 columns hide-for-large-up">             <strong>recensent</strong>         </div>         <div class="small-8 columns table__responsive-body-content">             <a href="/users/24">john doe</a>         </div>     </div> </div> 

i want find succeeding div node preceding sibling div containing strong node given text.

for example: given <strong> node text find betyg. expect return:

<div class="small-8 columns table__responsive-body-content">5<p>     <strong>skapades den: </strong>28 jun 09:44</p> </div> 

the following xpath describe:

//div[strong/text()[contains(., 'betyg')]]/following-sibling::div 

find div containing strong child element, contains text betyg. find following sibling div.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -