Micro Focus QTP (UFT) Forums
If Loop takes time - 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: If Loop takes time (/Thread-If-Loop-takes-time)



If Loop takes time - Forrest Gump - 09-17-2011

Hi All,

How to make script run at normal speed when "If condition" is inserted in script?

I mean, I have script like:

Code:
If Window("Flight Reservation").Exist then
Window("Flight Reservation").WinMenu("Menu").Select "File;Exit"
DataTable.Value("Act_Res")="Pass"
Reporter.ReportEvent 0,"Login Details","Valid Values"
else
Dialog("Login").Activate
Dialog("Login").WinButton("Cancel").Click
DataTable.Value("Act_Res")="Fail"
Reporter.ReportEvent 1,"Login Details","Invalid Values"
End If

Now at starting of "IF Condition" it takes 5 seconds or sometimes 10 seconds to check whether window exists.

I dont want QTP to wait for 10 seconds. How to avoid it?

Above I posted sample code but in real time I work on other applications and it has several If loop and my script waits for more time.

How to overcome this wait time and make qtp to execute script at normal time?
Pls help


RE: If Loop takes time - vIns - 09-17-2011

Hi,
Plz use
.Exist(1)

' here 1 is the time in sec. it s timeout period to check if the object appears in that time period. you can put even 0. if you do not mention, it will take default time usualy 60 seconds or so.