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.

Link Name Change

chercher Members
edited November -1 in Sahi - Open Source
I wonder if anybody could help me over-come a problem i have encountered...

Basically, i'm trying to run a loop on a login / logout process, where i am entering different Username's and Password's to check the validation of those applicable fields, however, when i'm trying to logout i keep getting an error.

_click(_link("login"));
_setValue(_textbox("username"), $USR);
_setValue(_password("password"), $PWD);
_click(_submit("Submit"));
_click(_link("logout: tester"));

This is an example of the script i'm using, the $USR & $PWD use an array which are kept in values.sah and is passed in through _include. My problem is the _click(_link("logout: tester")); - the username which is passed in is displayed within the hyperlink which is then used to log that user out. However, as i am testing entering various different username, the hyperlink name changes and trying to capture these changes is where my problem lies.

I tried replacing the "logout: tester" with $LOGOUT (variable - $LOGOUT="logout: $USR") but i keep getting an error..

Maybe there's a very simple solution to this but i must be having a mental block as i can't find anything within the Sahi documentations that i have been reading that deals with a similiar issue...Any help would be very much appreciated.

Comments

  • chercher Members
    I was having a mental block i've worked it out - i just needed to use the 'Alternative' for that hyperlink e.g. _click(_link(8));
  • narayannarayan Administrators
    You could use:
    _click(_link("logout: "+$USR[i]));
    
    or
    _click(_link(/logout/));
    
Sign In or Register to comment.