Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to run same script for different URLs when loading time is different
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
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)
User_name = Datatable.Value("User_name",Global)
Password = Datatable.Value("Password",Global)
Users = Datatable.Value("Users",Global)

systemutil.Run "iexplore",URL
Wait (5)


Browser("InSync :: Login").Page("InSync :: Login").WebEdit("txtUsername").Set User_name
Browser("InSync :: Login").Page("InSync :: Login").WebEdit("txtPassword").Set Password
Browser("InSync :: Login").Page("InSync :: Login").WebButton("Login").Click
Wait (5)
Browser("InSync :: Login").Page("InSync :: Login_2").WebList("ddlUsers").Select Users
Wait (8)

'Select Facility
If  Browser("InSync :: Login").Page("InSync :: Login_2").WebButton("Ok").Exist Then
    Browser("InSync :: Login").Page("InSync :: Login_2").WebButton("Ok").Click
    Wait (4)
End If
Wait (20)

'Access Scheduler
Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image2").Click
Browser("InSync :: Login").Page("InSync :: Visit Scheduler").Sync
Wait (50)

'Access Patient Search
Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image3").Click
Browser("InSync :: Login").Page("InSync :: Patient Search").Sync
Wait(25)

Browser("InSync :: Login").Close

------------------

Thanks,
Mansi.
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
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

count=1
While Not blnImg
    Wait (1)
     blnImg=Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image2").Exist

     count=count+1
     If count=50 then
        blnImg=True
    End if
Wend


Thanks,
Ricks
Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
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.
Reply
#4
Solved: 11 Years, 4 Months, 3 Weeks ago
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)
User_name = Datatable.Value("User_name",Global)
Password = Datatable.Value("Password",Global)
Users = Datatable.Value("Users",Global)

systemutil.Run "iexplore",URL
Wait (5)


Browser("InSync :: Login").Page("InSync :: Login").WebEdit("txtUsername").Set User_name
Browser("InSync :: Login").Page("InSync :: Login").WebEdit("txtPassword").Set Password
Browser("InSync :: Login").Page("InSync :: Login").WebButton("Login").Click
Wait (5)
Browser("InSync :: Login").Page("InSync :: Login_2").WebList("ddlUsers").Select Users
Wait (8)

'Select Facility
If Browser("InSync :: Login").Page("InSync :: Login_2").WebButton("Ok").Exist Then
Browser("InSync :: Login").Page("InSync :: Login_2").WebButton("Ok").Click
Wait (4)
End If
Wait (20)

'Access Scheduler
Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image2").Click

'code to replace wait

[color=#FF0000]blnImg=Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image2").Exist

count=1
While Not blnImg
Wait (1)
blnImg=Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image2").Exist

count=count+1
If count=50 then
blnImg=True
End if
Wend [/color]

'End of code to replace wait


'Browser("InSync :: Login").Page("InSync :: Visit Scheduler").Sync
'Wait (50)

'Access Patient Search
Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image3").Click
Browser("InSync :: Login").Page("InSync :: Patient Search").Sync
Wait(25)

Browser("InSync :: Login").Close
------------

Pleaes help me...
Reply
#5
Solved: 11 Years, 4 Months, 3 Weeks ago
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.
Reply
#6
Solved: 11 Years, 4 Months, 3 Weeks ago
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
count=1
While Not blnImg
Wait (1)
blnImg=Browser("InSync :: Login").Page("InSync :: Login").WebElement("InSync® EMR and Practice").Exist

count=count+1
If count=8 then
blnImg=True
End if
Wend

-----

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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to send/pass UFT Run Error Dialog as output value to main driver script lravi4u 0 635 11-05-2023, 03:55 PM
Last Post: lravi4u
  How do you Change Run mode mid script? Caleytown 6 7,360 03-25-2021, 08:27 AM
Last Post: RB26578
  QTP not recogonising object during run time Lavanya N 2 3,746 10-28-2015, 12:46 PM
Last Post: vinod123
  Writing to Run time data table Neetha 5 12,211 08-27-2015, 10:18 AM
Last Post: supputuri
  How to run driver script to kick off scripts stored in QC? shipu 0 3,613 04-30-2014, 02:39 AM
Last Post: shipu

Forum Jump:


Users browsing this thread: 1 Guest(s)