18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
get number of elements
let's say I access my <span> elements using
_span({className:"amount"})
However, I have a lot of span having class name amount. How to get the 2nd, 3rd, etc elements?
_span({className:"amount"})
However, I have a lot of span having class name amount. How to get the 2nd, 3rd, etc elements?
Answers
You can access the 2nd, 3rd elements using positional APIs like _near, _in, _under etc. They can be identified with reference to known elements around them in DOM structure.
You can find the details on the following link.
If there is visible text for the span you want to access,
you can also try using:
Regards.
You can access the spans using the following code:
Regards.
If you're unaware of the text around the elements, you can use the code in my first reply, as it doesn't require prior knowledge of the surrounding text.
Regards.