18 January 2026:


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 a variable inside ""

jameztccjameztcc Members
edited November -1 in Sahi - Open Source
Hi,

any hint how to fix the following example?


var $i=1;

while ($i<10) {
$i++;
_click(_link("$i"));
}


Such that it will run as "_click(_link("1"));" and not "_click(_link("$i"));"?

thanks,
James Tan

Comments

  • narayannarayan Administrators
    Hi James,

    You can convert an int to string by adding to a blank string. Then it will correctly come up as "1".
    var $i=1;
    while ($i<10) {
        $i++;
        _click(_link("" + $i));
    }
    

    Regards,
    Narayan
  • Hi Narayan,

    thanks again for the hint and code example.

    thanks,
    James Tan
Sign In or Register to comment.