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.

_wait Problems

tower120tower120 Members
edited November -1 in Sahi - Open Source
Hi!

I got some problems with _wait. I try something like this:
_wait($time, _isVisible($element) == true );

It fires BEFORE element becomes visible. So, I try this instead:

function waitForVisible($element, $time){
for ($i=0;$i<$time;$i+=100){
_wait(100);
if (_isVisible($element)){
return true;
}
}

throw "Element is non visible!";
}

My question is: How I can force throw error so SAHI can process it correct? Or what I do wrong with _wait?

Thank you.

Comments

  • _wait(1000, _isVisible($element))
    // Will wait till visible element
    // or one second, whichever occurs sooner
  • tower120tower120 Members
    Hi!

    can someone get this work under Chrome?

    _wait(5000);
    _alert('asda');
  • tower120tower120 Members
    I make simple page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
        <div id="output">Not started</div>
       
           <button onclick="stage1()" id="stage1">Stage1</button> </br>
        <button onclick="stage2()" id="stage2">Stage2</button>
           
        <script type="text/javascript">
            function stage1(){
                document.getElementById("output").innerHTML = "Stage 1";            
            }
            
            function stage2(){
                document.getElementById("output").innerHTML = "Stage 2";            
            }
            
        </script>
    </body>
    </html>
    
    


    to test this script:
    _click( _byId("stage1") );
    _wait(15000);
    _click( _byId("stage2") );
    


    And it does not work anywhere! I mean I saw stage2 at once, not after 15sec.
  • tower120tower120 Members
    edited May 2011
    When concat.js in effect? When concat3 and when concat7 ? That stored inside \sahi\htdocs\spr\
  • tower120tower120 Members
    Hmm.... it seems not work only in "Evaluate expression" window in Sahi Controller.
Sign In or Register to comment.