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 the function _getText effectively?

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

I am trying to gt text from the application using _getText function.

Example :
$val=_getText(_link("_displayAvailabilityID"));
_debug($val);

The result I am gettig is _debug(_getText(_link("_displayAvailabilityID"));
);


I am expecting the actual text availabe on the link i am passing.

How can i get the value in the variable $val?

Thanks!!

Comments

  • Syntex is not having issue might be element identification problem .....Try to use some alternative for link identification " _link("_displayAvailabilityID");" or use some regular expression.

    Try this

    $val=_getText(_link("/.*displayAvailabilityID/"));
    _debug($val);


    cause here i am using same kind of structure for getText in my framework and script and its working fine. Difference is that one only.....so just check it out...it might help.
  • narayannarayan Administrators
    Hi Amruta,

    Are you using an older version of Sahi? If yes, try picking the latest.
    If you do not want to move away from the older version, you could use
    var $val;
    _set($val, _getText(_link("_displayAvailabilityID"));
    _debug($val);
    

    Regards,
    Narayan
Sign In or Register to comment.