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.

How to solve Timing Issue

GeorgeGeorge Members
edited November -1 in Sahi - Open Source
OS : Windows 7
Browser : Firefox 7.0.1 or older versions
Build : 2010-11-03

Sub : My query & your answer to that is given below

But... Sumitra... when i used this command as you said... It keeps on executing the link till the maxtime.
Eg: when i give
_wait(50000, _click(_link("Candidates")));
_wait(50000, _click(_link("Assignments")));
today the "Candidates" link took only 15 seconds to finish.. but it kept on executing 3 times.
and the "Assignments" link took only 20 seconds to finish.. but it kept on executing 3 times... till the 50 seconds are passed.

I want to execute "Candidates" and as soon is it get loaded it should pass on to "Assignments" link... not to keep executing the same link.

Please advise.

George


Old Query & your answer.
(I have scripts with many click links which takes different timing to load on different run.

Eg: if the click event 1 takes 20 seconds to load at the first time, then it may take 30 seconds at the second time... so i cannot put a _wait(30000) as an optimal time.. because it may take 40 seconds at the next run...depends on the performance speed of the site.
Is there any statement where i can put in the begening of the script which the script controller understands to take the appropriate time between each events... so that i don't need to put the _wait statement... and to wait the maximum time to run the scripts.
This is been a serious issue for me since i want to run many scripts in the minimum time.

PLEASE ADVISE ME what to do.. or how to solve this issue.

thanks in advance,

George

Re: How to solve Timing Issue

Hi George,

If you are using _wait(30000);// Incase the link is loaded before 30 secs then unnecessarily you will have to wait for remaining sec.

You can use: _wait(maxTime, condition);

In your case it would be : _wait(200000,_click(_link("First link Identifier")));

_wait(300000,_click(_link("Second link Identifier")));

Regards
Sumitra)

Comments

  • narayannarayan Administrators
    Hi George,
    First, you do not need to put a wait. Sahi should automatically wait for page loads.
    Sumitra's previous answer is also incorrect.
    _wait(50000, _click(_link("Candidates")));
    is not right.

    // You click on the link
    _click(_link("Candidates"));
    // If you want to wait till the assignment link shows up, you do:
    _wait(50000, _exists(_link("Assignments")));
    // Then
    _click(_link("Assignments"));

    Ideally you should be able to just do

    _click(_link("Candidates"));
    _click(_link("Assignments"));

    Regards,
    Narayan
  • Thanks Narayan....

    but what happens actually when i give the following 2 statements one after the other .. is..

    _click(_link("Candidates"));
    _click(_link("Assignments"));

    sahi trying to execute "Candidates" for few seconds and jumps to the next statement "Assignments" which is in the Candidate page... but since the "Candidates" page is not loaded yet.. it fails to find the link.... it say FAILURE..
    i can put wait statements for 60 seconds on each statement.. but then i am waisting time.. sometimes the page loads in 20 secs or sometimes in 50 secs.. depends on site performance.

    i want all the commands get executed irrespective of the page load time.

    PLEASE ADVISE.

    regards

    George
  • narayannarayan Administrators
    Hi George,

    As said earlier, Sahi should automatically wait for the page load. Switch to the latest Sahi release and check. Most timing issues have been fixed in the newer releases.

    Regards
    Narayan
  • kishorekishore Members
    edited May 2013
    Hi narayan

    The timing issues are still there.

    _click(_link("link1"));
    _wait(10000,_isVisible(_link("/link2 /"))||_isVisible(_link("/link1/")));
    if(_isVisible(_link("/link1 /")))
    {
    _click(_link("/link1/"));
    }
    else
    {
    //do Somethin else
    }


    without wait statement, condition comes into //do Somethin else, it does not wait for page getting fully loaded

    am using Sahi Pro 4.5.2

    regards,
    Kishore
Sign In or Register to comment.