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.
Insert number into string
All,
Can someone tell me what is wrong here? I've tried all the variants I can think of!
for (var $i=1; $i<6; $i++) {
_click(_link("Change to Custom", _near(_cell("number " + $i + "of 5"))));
}
At run time I just get:
_click(_link("Change to Custom", _near(_cell("number " + 1 + "of 5"))));
_click(_link("Change to Custom", _near(_cell("number " + 2 + "of 5"))));
etc
Whereas of course I am looking for
_click(_link("Change to Custom", _near(_cell("number 1 of 5"))));
_click(_link("Change to Custom", _near(_cell("number 2 of 5"))));
etc
??
Thanks in advance!
Can someone tell me what is wrong here? I've tried all the variants I can think of!
for (var $i=1; $i<6; $i++) {
_click(_link("Change to Custom", _near(_cell("number " + $i + "of 5"))));
}
At run time I just get:
_click(_link("Change to Custom", _near(_cell("number " + 1 + "of 5"))));
_click(_link("Change to Custom", _near(_cell("number " + 2 + "of 5"))));
etc
Whereas of course I am looking for
_click(_link("Change to Custom", _near(_cell("number 1 of 5"))));
_click(_link("Change to Custom", _near(_cell("number 2 of 5"))));
etc
??
Thanks in advance!
Comments
What you get is correct, and it would work correctly if you gave a space before "of 5".
It should be
_click(_link("Change to Custom", _near(_cell("number " + $i + " of 5")))); // space before of
Regards,
Narayan
Sorry, the missing space was just me misquoting. The problem seemingly isnt the space. The problem is that seemingly (at least this is what I see in the controller) - ' "+ $i " ' is being translated as exactly that including the quotes and + signs etc. I just want "number $i of 5" (with $i substituted.