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.

Mismatch between actual load time and time which Sahi shows

vineet.arora3vineet.arora3 Members
edited November -1 in Sahi - Open Source
Hi,

I need to calculate the loadtime for a page and am using this script:

//Find time before navigating to a page
var $starttime = new Date().getTime();
_navigateTo("http://www.abc.com";);

var $finishtime = new Date().getTime();
//Just before setting value in a textbox, I am calculating time.
_setValue(_textbox("q"), "vineet");

var $loadTime = $finishtime - $starttime;
_log("load time = " + $loadTime + " ms");

This time which is $loadtime is very less as compared to the time calculated manually for the same page load. Why there is so much difference of about 6-7 seconds?

Do I need to change something in Sahi configuration file?

Thanks

Comments

  • narayannarayan Administrators
    Hi Vineet,

    _navigateTo considers itself done when the command has been issued to the browser.
    It is the next command (_setValue(_textbox("q"), "vineet");) that waits till the page loads.
    Add a simple statement using a browser action API before the end time:
    //Find time before navigating to a page
    var $starttime = new Date().getTime();
    _navigateTo("http://www.abc.com");
    //Dummy statement which helps wait till page load 
    _assertExists(_title()); 
    var $finishtime = new Date().getTime();
    //Just before setting value in a textbox, I am calculating time.
    _setValue(_textbox("q"), "vineet");
    var $loadTime  = $finishtime  - $starttime;
    _log("load time = " + $loadTime + " ms");
    

    Regards,
    Narayan
Sign In or Register to comment.