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 method doesn't wait for Object if object is declared in variable

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

I am facing an issue (or might be need to know more on that),

But _wait method doesn't wait for an Object if object is declared in a variable as given below-

Prior implementation(works fine):
_wait(8000,_cell("All Items"));


Changed above wait as such(This method doesn't consider object for wait & waits for 8000 ms only):
_wait(8000,$_CELL_ALL_ITEMS);

& I declared

var $_CELL_ALL_ITEMS = _cell("All Items");


Please let me know if I misunderstood something here.

Thanks & Regards,
Ashish

Comments

  • SumitraSumitra Members
    Hi ashishbaraiya,

    Can u tell me what version of Sahi Pro are you using?

    Also, have you appened wait script from the controller?

    Regards
    Sumitra
  • Hi Sumitra,

    I am using SAHI's open source version 3.5 (dated 25-5-2011). as per our project requirement we have created a framework & so I require to use variable for objects.

    We have manually added wait statements in our scripts.

    Thanks,
    Ashish
  • SumitraSumitra Members
    Hi ashishbaraiya,

    Yes, this works.

    Use:

    var $_CELL_ALL_ITEMS = _cell("All Items");
    _wait(8000,$_CELL_ALL_ITEMS);

    Let me know if you face any problem.

    Regards
    Sumitra
  • yes Sumitra,

    That's what I used which you have provided, but still it doesn't work & waits for whole 8000 ms.

    Please help me on this.

    Thanks,
    Ashish
  • SumitraSumitra Members
    Hi ashishbaraiya,

    The following code works for me with the base URL as:

    http://www.zkoss.org/zkdemo/composite
    _navigateTo("http://www.zkoss.org/zkdemo/composite");
    var $link = _link(/u0$/);
    //if it doesn't identify the link correctly, it waits for 100 seconds
    //else the execution goes normal after finding the link 
    _wait(100000,$link);
    _click($link);
    

    I hope this would help you to solve your issue.

    Let me know if you are facing any problem.

    Regards
    Sumitra
  • Akss004Akss004 Members
    edited July 2011
    Hi Sumitra,

    Its not working in my case also. Check the recorded Script and Execution log. Its appending some strange characters(s_v) before that element while executing the script. I am using FF5 as browser and Sahi (Build: 2011-07-19) on Windows OS.

    Script Recorded
    ***************************************************************
    _setValue(_textbox("login"), "admin");
    _setValue(_password("password"), "password");
    _click(_submit("Sign In"));

    var $Test = _link(/Settings/) ;

    _wait(10000,$Test);

    _click($Test);

    ****************************************************************


    Execution Log.
    ****************************************************************
    _setValue(_textbox("login"), "admin");
    _setValue(_password("password"), "password");
    _click(_submit("Sign In"));

    _wait(100000, ""+s_v(_link(/Settings/))+"");

    _click(_link(/Settings/));
    --Stopped Playback: SUCCESS--
    ****************************************************************

    Note that here script is successfully executed but it is waiting for 100 sec though element is present there after 1 sec.
  • SumitraSumitra Members
    Hi Akss004,

    Can you please post the URL?

    Regards
    Sumitra
  • Hi Sumitra,

    your provided example code drafted below:

    _navigateTo("http://www.zkoss.org/zkdemo/composite";);
    var $link = _link(/u0$/);
    //if it doesn't identify the link correctly, it waits for 100 seconds
    //else the execution goes normal after finding the link
    _wait(100000,$link);
    _click($link);

    I have tried the same code you gave, but that's also keep me waiting for '100000' ms at _wait(100000,$link); statement.

    & also tried the below code for example, it also doesn't recognize object mentioned in the wait statement, see the example I have tried-

    var $url = "http://www.google.com/";
    var $googleSearchbox = _textbox("q");

    _navigateTo($url);
    _wait(10000,$googleSearchbox);
    _setValue($googleSearchbox, "Try");
    _click(_submit("Google Search"));


    in the above example, it keeps me waiting at '_wait(10000,$googleSearchbox);' line even if the textbox appeared finely.

    Please tell me if we are missing anything here, cause as per you it works fine there at your end but doesn't at ours.

    Thanks,
    Ashish Baraiya
  • Thanks a lot for providing quick solution on this issue.

    - Ashish
Sign In or Register to comment.