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.

_popup and while loop

rj412rj412 Members
edited November -1 in Sahi - Open Source
Need syntax help for while loop with _popup:
I tried the following but none works.
Please help.
Env: Windows, IE 6 ; Sahi_20101103

while(_popup($popupWindow)._assertNotExists(_cell("/Results are:/"))) {
_wait(1000);
doSomethingElse ();
}
while(_condition(_popup($popupWindow)._assertNotExists(_cell("/Results are:/")))) {
_wait(1000);
doSomethingElse ();
}
while(!_popup($popupWindow)._assertExists(_cell("/Results are:/"))) {
_wait(1000);
doSomethingElse ();
}
while(!_exists(_popup($popupWindow)._cell("/Results are:/"))) {
_wait(1000);
doSomethingElse ();
}

Comments

  • narayannarayan Administrators
    Use like this:
    while(true) {
          var $condn = false;
          _popup($popupWindow)._set($condn, _exists(_cell("/Results are:/")));
          if ($condn) break;
           _wait(1000);
           doSomethingElse ();
    }
    

    Regards,
    Narayan
  • I think both of my issue with _getText and _exists are related and both times failed when used with _popup
    Let me explain why:
    With hard-coded popup Window Title is used- both of these operation work.
    But once popup window is reference with /.* -xxxxx- .*/ - the same operations no longer work: getting [Exception][object Object]


    //when _exists works with _popup
    _popup("Test Page - This is only a Test - user1 (Sample/User/Text)")._exists(_div("This user has already been taken"));
    //when it does not work with a reference popup
    var $popupWindow = "/.*This is only a Test.*/" ;
    _popup($popupWindow)._exists(_div("This user has already been taken"));
    //when it does not work with a reference popup
    var $popupWindow = "/.*This is only a Test.*/" ;
    var $condn = false;
    _popup($popupWindow)._set($condn, _exists(_div("This user has already been taken")));
    _debug($condn) ;

    //when _getText works with _popup
    _popup("Test Page - This is only a Test - user1 (Sample/User/Text)")._getText(_div("This user has already been taken"));
    //when it does not work with a reference popup
    _popup($popupWindow)._getText(_div("This user has already been taken"));
    //when it does not work with a reference popup
    var $popupWindow = "/.*This is only a Test.*/" ;
    var $ReadText ;
    _popup($popupWindow)._set($ReadText, _getText(_div("This user has already been taken")));
    _debug($ReadText) ;
Sign In or Register to comment.