The test script attached to this KB article introduces the function:
Dump page load time:
NavPerformance();
You can call it at any time after a web action is performed
(Navigator.Navigate or SeS(‘…’).DoClick()) and you want to check the page loading time
or see information about the loaded resources.
There are a couple more uses of this function.
Dump page load time and resources:
NavPerformance(true);
By default this function returns the page load time in
milliseconds as a number. So you can use it later for additional validations.
A extra benefit of this function is that information about the timings is also written into the
report.
var tm =
NavPerformance();
Tester.Assert("Navigation
took less than a second", tm<1000);
To return page load and write nothing to the report:
var tm =
NavPerformance(false, true);
Implementation of this function is in the .user.js file of
the attached test. If you have complex test set you may put it into a common
.js file for all your tests.