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.

Variable Link

spchinspchin Members
edited November -1 in Sahi - Open Source
I am trying to click a link that is a variable I set, but am not sure of the syntax. Here is the example:

_set( $entity, _random(999999) );
_click(_link("$entity[1]"));

Let's say the random number generated was 12345. Then this is what I want to happen:

_click(_link("12345[1]"))

Can someone please help me with the correct syntax? Thanks in advance for any help.

Comments

  • TheeranTheeran Members
    Hai spchin,

    In your script,it actually finds for a link with name $entity[1].You should specify the variable name in _link instead of string.

    Try using the following code:

    var $entity = _random(999999);
    _click(_link($entity + "[1]"));

    Regards
    Theeran
  • spchinspchin Members
    Thanks Theeran, this solved my problem!
This discussion has been closed.