L
L
LebedevStr2019-07-23 18:29:51
XPath
LebedevStr, 2019-07-23 18:29:51

What is the XPATH in this situation?

Hello. There are two HTML markups:
1

<div class="common">
some code
<a href="#" class="link">link</a>
some code
</div>

2
<div class="common">
some code
<a href="#" class="link">link</a>
some code
<div class="none">some txt</div>
some code
</div>

Question.
It is required to pick up (get through) to <a>with the class link, but not to pick up <div class="common">if it contains <div class="none">some txt</div>.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-07-23
@LebedevStr

//div[@class="common" and not(.//div[@class="none"])]//a[@class="link"]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question