Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, windows and java based applications. Get your 30 day free trial.
Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @ sahipro.com
Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @ sahipro.com
Insert number into string
RensterUK
Members
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.