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 use variables as index to an array?
on my previous computer I used Sahi version 20091023
On a new computer I installed Sahi version 20130206
Some of my scripts don't work anymore
The statement that works on both versions: _click(_link("here[3]"));
The statements that worked on the old version but fail on the new version: var $index=3; _click(_link("here[$index]"));
The var statement is in a script file that is included
The logfile says: "The parameter passed to _click was not found on the browser"
What is changed in the newer version causing by scripts to fail?
How can I correct that?
Thanks
On a new computer I installed Sahi version 20130206
Some of my scripts don't work anymore
The statement that works on both versions: _click(_link("here[3]"));
The statements that worked on the old version but fail on the new version: var $index=3; _click(_link("here[$index]"));
The var statement is in a script file that is included
The logfile says: "The parameter passed to _click was not found on the browser"
What is changed in the newer version causing by scripts to fail?
How can I correct that?
Thanks
Answers
Please try using below code.
Regards,
Pratik Shah
As this involves editing almost a hundred lines in my scripts, I think I will install the older version.
When a new release of Sahi reinstalls the old (IMHO the right) behavior, I will try again
what ever you said is current, you need to edit hundred's of lines, but think about future also.
If u keep on updating your script, it gonna be hundreds/ thousands of lines in future, if you update the sahi version in future, your script will be thousands of lines at that moment, it will be very difficult for you to update that many lines of codes at a time.
Instead of that if you could update your code now itself, it would be easy for you to support in upcoming versions.
If possible why don't you go with Replace with option(Ctrl + H), to replace all the lines at a time
Just its my opinion, if possible you can follow
Variables inside double quotes must be replaced, inside single quotes not.
E.g. var $p=25;
"Value of p = $p" must have string result Value of p = 25
'Value of p = $p' must have string result Value of p = $p
An alternative for not replacing the variable and use double quotes is the use of a backslash like this:
"Value of p = \$p" must have string result Value of $p