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.

getText, containsText, and If does not work, does not function

irpaloirpalo Members
edited November -1 in Sahi - Open Source
Hi All,

I cant figure out why this codes does not work in sahi, it keeps logging error.

1.) I basically, just want to test if the text in the cell exist. The _cell does exist with the text.
if( _condition( popup(document.title)._getText( _cell(_table("T2"), 0, 1) )== "some text" ) )

_popup(document.title)._alert("some alert");


2.) Since the first does not function, so i made this, bust still doesn't work:
if( _condition( popup(document.title)._containsText( _cell(_table("T2"), 0, 1),"some text" )==true ) )

_popup(document.title)._alert("some alert");

3.) In this code, I try to assign the text value to $x.

var $x;
_popup(document.title)._set($x,_popup(document.title)._getText( _cell(_table("T2"), 0, 1)) );

//or another variation still does not work:
var $x;
_set($x,_getText( _cell(_table("T2"), 0, 1)) );


I tried everything but still does not work. I tried versions 2008, 2007 and 2006 and all errors.
Someone please help me. Tnx

Comments

  • Hi,

    Try this if it helps:

    if( _condition(_getText( popup(document.title)._cell(_table("T2"), 0, 1) )== "some text" ) )

    _alert("some alert");

    Revert back with results/issues.

    Regards,
    Pankaj.
  • I already tried that, but there is a Sahi Window Exception. It seems it cant find the correct window.
    That is why i used the _popup(document.title)._getText .
  • rksrks Members
    Not sure but I have faced quite a lot issues with the pop up windows. I guess you too are facing same issue. In my tests, I have seen that handling for pop up windows is not quite reliable. May be Narayan can provide some insight.
Sign In or Register to comment.