Sample html:
<div>
<div class="foo bar baz"> <-- target 1 -->
<div>
<span>
<a href="helloworld.com">hello world</a>
</span>
</div>
</div>
<div class="foo bar">foo</div>
<div class="bar"> <-- target 2 -->
<div>
<div>
<span>
<a href="helloworld2.com">hello world</a>
</span>
</div>
</div>
</div>
</div>
I want to select: divs that: 1)has class name bar 2) has an <a> descendant whose href contains hello.
My problem is that the <a> tag could be nested in different levels. How to handle this correctly?