i have the following structure
<div >
<div >
<div >europpeen toys</div>
<div >100</div>
</div>
<div >
<div >us toys</div>
<div >n/d</div>
</div>
<div >
<div >books</div>
<div >350</div>
</div>
<div >
<div >sport</div>
<div >0</div>
</div>
</div>
how to write xpath expression (javascript) to select all list elements that contains
- a div with category class and the content should contains 'toys' keyword.
- and a div with price class
in this case the result should be
<div >
<div >
<div >europpeen toys</div>
<div >100</div>
</div>
</div>
thanks
CodePudding user response:
This should work
//div[contains(div[1], 'toys') and div[2][@class='price']]