How to run same script for different URLs when loading time is different - 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: How to run same script for different URLs when loading time is different (/Thread-How-to-run-same-script-for-different-URLs-when-loading-time-is-different) |
How to run same script for different URLs when loading time is different - mansis - 09-18-2012 Hi All, I have prepared following script which needs to be executed on 5-10 live clients every day after deployment of new changes/enhancements. Load time of each page is different for each live clients. After deployment, our server gets bit solve and loading speed may differ each time. In below script, I have used "wait" command to get page loaded.. Now the problem is.. Page size of pages different for each client.. Due to which, for some client's site, one page gets loaded fast and for some, its too slow.. If site is slow for any client, then errors of object occurs. Due to which I need to increase seconds in "Wait" command during run. Because of which if any of site is fast then also it will perform wait operation which results in wastage of time. Can any one provide me the solution.. Here do I need to use looping for "wait" command.. If yes, please provide me the code for same.. Please help me urgently.. Below is the script.. ----------------- Code: URL = Datatable.Value("URL",Global) ------------------ Thanks, Mansi. RE: How to run same script for different URLs when loading time is different - ricks_ngl - 09-18-2012 Hi Mansi, Use the below code and try instead of giving wait command, Code: blnImg=Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image2").EXist Thanks, Ricks RE: How to run same script for different URLs when loading time is different - mansis - 09-19-2012 Hi Ricks, Thanks for reply.. But can you please integrate your code in my script? I am NOT getting where to place your code in my script by replacing wait command..At how many places should I need to replace your code with my wait command? .. Thanks, Mansi. RE: How to run same script for different URLs when loading time is different - mansis - 09-19-2012 Hi, While I am running script by replacing your code with "Wait" command, it skip execution of entire "Scheduler" module and start executing next "Patient search".. Below is the script... ----------------- Code: URL = Datatable.Value("URL",Global) Pleaes help me... RE: How to run same script for different URLs when loading time is different - ricks_ngl - 09-20-2012 I thinik you forgot to perform the click operation. Once the Image exist, then you need to click it right. Code: Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image2").Click Add this code after the "Wend" and you should be all set. All the best. RE: How to run same script for different URLs when loading time is different - mansis - 09-21-2012 Hi, Thanks for your help..It works now.. But I need your favor.. Can you please explain me the following code which you gave me so that I can use it, if It is fully clear for me... ---- Code: blnImg=Browser("InSync :: Login").Page("InSync :: Login").WebElement("InSync® EMR and Practice").Exist ----- Below is my understanding of code and questions list- Here, in above code, I think first you have define the variable bInImg in which you have checked that object is Exist or not.. Lets say for first time bInImg = false (because object may not be loaded) Now you have define one more variable count by taking value 1. Next is time of loop.. While Not bInImg (i.e. while bInImg = false) then wait (1) now I don’t understand that why you have again define bInImg by again checking that object is Exist or not? Let say if now bInImg = True / False it will increase count by 1 and will check if condition that count = 8 or not.. Here my one more question is instead of above code, if I used wait (8) then it will wait for 8 secs and if I use above code then it will run 8 iteration of loop. So what is difference in using 8 secs and 8 iteration loop… Here if after performing 8 iteration also page is yet not loaded then this code will be failed.. right?? Please kindly explain me in detail.. I am beginner in QTP so needs to patience help.. Thanks a lot, Mansi. |