Reputation: 199
I don't have any idea to get last locator from div
I try to count elements by Get Element Count
in div
but it got just 1
example html
<div class="add-product"
<p data-aura-rendered-by="188:14729;a">
<span data-aura-rendered-by="191:14729;a">01-January</span>
<p data-aura-rendered-by="195:14729;a">
<span data-aura-rendered-by="198:14729;a">02-February</span>
<p data-aura-rendered-by="230:14729;a">
<span data-aura-rendered-by="233:14729;a">07-July</span>
</p>
</div>
I need to count all elements in div
or get last position in div
(07-July) but each time the div
contains a different number of elements (it depends on test data).
Upvotes: 0
Views: 1674
Reputation: 33384
Use the following xpath
it will identify the last element 07-July
.
(//div[@class='add-product']//span)[last()]
Upvotes: 5