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 store different url in a single variable

akshaymgsakshaymgs Members
edited November -1 in Sahi - Open Source
I'm using a for loop in my script.

I've to store a url onto a variable that i will use in the script later.

So is there any process that i can use a single variable for storing all those url.

Comments

  • Hi akshaymgs

    you could store them in an array... in your loop use: _set(urls[$i], document.location.href) or you use urls.push(document.location.href)

    Regards
    Wormi
  • Hi Wormi,

    I'm not getting it correctly.

    I'm taking the link for the one cycle by the following:-

    $code=_getText(_link("stubcode"));


    then I've to navigate to it after wards:

    _navigateTo($code, true);

    Now I need a way that this code variable become an array so that in the loop I can call like

    For ex:-
    $code[$i]=_getText(_link("stubcode"));


    _navigateTo($code[$k], true);
  • globalwormingglobalworming Moderators
    edited November 2011
    var $urls=new Array();
    for($i; $i<XXX; $i++)
      $urls[$i]=_getText(_link("stubcode"));
    }
    for($k; $k<$urls.length; $k++){
      _navigateTo($urls[$k])
    }
    
    
  • Thanks Worming..........
    Now it is working.
This discussion has been closed.