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.

is it possible to get text of object without using _set()

gaveyomgaveyom Members
edited October 2012 in Sahi - Open Source
Dear Sahi Team/ Users,

is it possible to get text of object without using _set() method

Example :

var $subReport = _collect("_link", "/./", _in(_div("body")));
var $arry_SubReport = [];

for (var $j=0; $j<$subReport.length; $j++) {
        
     _set($arry_SubReport[$j], $subReport[$j].text);
     _debug($subReport[$j].text);
}


when im using "_debug($subReport[$j].text);" this its not displaying text instead its displaying like

_debug(String(_link("/./[0]", _in(_div("leftmenu2"))).text));

is there any other option to get/ display text without assign to "$arry_SubReport[$j]"

due to this its wasting of time in assigning to another variable again

is there any other alternate way to get/ display a text directly by using "$subReport[$j].text" variable

Comments

  • Hi

    try _getText(element)

    regards
    Wormi
  • gaveyomgaveyom Members
    edited October 2012
    Hi

    thank you for your quick reply.

    its also behaving like _set() only

    until i assign value to variable by using _set() v cannot get actual text

    actual code
    
    var $subReport = _collect("_link", "/./", _in(_div("body")));
    var $arry_SubReport = [];
    
    for (var $j=0; $j<$subReport.length; $j++) {
            
         _set($arry_SubReport[$j], $subReport[$j].text);
         _debug($subReport[$j].text);
    }
    
    

    Example
         _set($arry_SubReport[$j], $subReport[$j].text);
         _debug($arry_SubReport[$j]);
    

    for this " _debug($arry_SubReport[$j]); " now it will display(sahi controller) actual text which is containing in " $subReport[$j].text " like
    "   _debug("actual text")   "
    

    if i will use directly _debug() without assign a value by using _set() like below
         _debug($subReport[$j].text);
    

    now it will display(sahi controller) like
    "   _debug(_link("/./[0]", _in(_div("leftmenu2"))).text)   " 
    

    instead of actual text

    can v get actual text which is existing under " $subReport[$j].text " without assining a value by using _set()

    by usin " _getText(ele) " im getting same like _debug() value, as shown below

    _debug(_getText(_link("/./[0]", _in(_div("details"))));
    

    instead of actual text

    actually it should be like "
    _debug("actual text")   "
    
Sign In or Register to comment.