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.
How to access multiple elements matching the regular expression
In the application, there are several elements with ids which has a serial number embedded in the id string:
<span id="control_ctl01_lblSomeLabel">Label value A</span><br />
<span id="control_ctl02_lblSomeLabel">Label value B</span><br />
<span id="control_ctl03_lblSomeLabel">Label value C</span><br />
...
using the following the 1st element can be retrieved:
_log(_getText(_span(/control_ctl.*_lblSomeLabel/)));
How to access subsequent labels?
With string the way it works was: _span("Label value[2]"); for example...
TIA,
<span id="control_ctl01_lblSomeLabel">Label value A</span><br />
<span id="control_ctl02_lblSomeLabel">Label value B</span><br />
<span id="control_ctl03_lblSomeLabel">Label value C</span><br />
...
using the following the 1st element can be retrieved:
_log(_getText(_span(/control_ctl.*_lblSomeLabel/)));
How to access subsequent labels?
With string the way it works was: _span("Label value[2]"); for example...
TIA,
Tagged:
Comments
See if _log(_getText(_span(/control_ctl.*_lblSomeLabel[2]/))); works for second label.
I had used it once and it worked for me.
Regards,
Pankaj