To calculate the page load time using a user defined function - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: To calculate the page load time using a user defined function (/Thread-To-calculate-the-page-load-time-using-a-user-defined-function) |
To calculate the page load time using a user defined function - Renu0113 - 09-29-2009 I have written the following function to calculate the load time for a page. Objective: Google home page opens Click on Google Maps link Get StartTime Once Google Maps page arrives, get StopTime Difference between StopTime and StartTime is the time the page takes to load. Problem: Even after the last step, the arrow is again at Step 3 (Browser("Bro_Google").Page("Pag_Google").Link("name:="&LnkName).Click) It doesnt stop at the last line,i.e at msgbox and doesnt provide me the result. Also, the result for msgbox StartTime is empty, no value and for StopTime its 0.. Code/Function is: Code: Public Function CheckLoadTime(ByVal LnkName,ByVal BroName,ByVal PagTitle) Saket,I am Sorry, I meant to post another issue I am facing in the same context, but I posted the old query.Sorry. Please help. -Joshi RE: To calculate the page load time using a user defined function - Saket - 09-29-2009 Hi Joshi, It is causing because you have sarted a timer('Timer1' ) and stopping another timer ('Timer2'). if you have started timer1 then you should stop the same timer only. you can use ElapsedTime method to get the time required to do the mentioned action by QTP. the aother issue has been discussed in another thread by you - solution is use only a single statement to call you function. if you will call it twice then obviously it will stuck at the position you mentioned try the code below Code: Public Function CheckLoadTime(ByVal LnkName,ByVal BroName,ByVal PagTitle) RE: To calculate the page load time using a user defined function - Renu0113 - 09-30-2009 Thanks everyone! I get it now. I have a question. I want to see the load time,no. of links etc using the checkpoint now, for Google homepage. I inserted the standard checkpoint(while recording), I have load time=2, no. of images=3, no. of links=30. Now, when I run the recorded script(checkpoint) on Google homepage, it fails. According to the results,it failed for "install Google chrome" link and "make Google my homepage" link. Why does this happen? Thanks, Joshi RE: To calculate the page load time using a user defined function - Saket - 09-30-2009 Hi Joshi, Please open a new thread for your new question. always put one query per thread. !!Thread is closed now!! |