Hello, today I stumbled upon a very interesting case (at least for me). I am messing around with Selenium and xPath and tried to get some elements, but got a strange behaviour:
<div class="resultcontainer">
<div class="info">
<div class="title">
<a>
some text
</a>
</div>
</div>
</div>
<div class="resultcontainer">
<div class="info">
<div class="title">
<a>
some other text
</a>
</div>
</div>
</div>
<div class="resultcontainer">
<div class="info">
<div class="title">
<a>
some even unrelated text
</a>
</div>
</div>
</div>
This is my data. When i run the following xPath query:
//div[@class="title"][1]/a
I get as a result ALL instead of only the first one. But if I query:
//div[@class="resultcontainer"][1]/div[@class="info"]/div[@class="title"]/a
I get only the first , not all.
Is there some divine reason behind that?
Best regards, bisko