Micro Focus QTP (UFT) Forums
How to Synchronize a particular webpage? - 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 Synchronize a particular webpage? (/Thread-How-to-Synchronize-a-particular-webpage)



How to Synchronize a particular webpage? - pupuns2 - 07-28-2008

For example : After giving userid and password, the next page may take sometime to comeup. It may take 2secs or 5 mins depending on net speed. So, i can synchronize the next page based on a particular bitmap or button or text or anything on that page. But here I don't want to specify any time limit because I don't know when the next page will come up.
So, is there any way to solve it ?


RE: How to Synchronize a particular webpage? - Rajashekar Gouda - 07-28-2008

U can use Browser("-").Sync or waitproperty() method
Regards
Raj


RE: How to Synchronize a particular webpage? - surya_7mar - 07-29-2008

You can wait until the you saw Done on the Browser Status.

Try to ass the browser status object and wait until browser status object is done


RE: How to Synchronize a particular webpage? - Rajashekar Gouda - 07-29-2008

Hye Surya,

Can u pls explain with more info? how can we make the script to wait until we saw Done on the Browser Status?

Any thing like code for refference

Regards
Raj


RE: How to Synchronize a particular webpage? - Rajashekar Gouda - 07-31-2008

Any updates on this

Regards
Raj


RE: How to Synchronize a particular webpage? - surya_7mar - 07-31-2008

Sorry i just came to this message.

here is the Function which will wait until the Browser gets loaded.
You can call after every operatins that need page to be refreshed.

Usage Ex:
Code:
Browser("Browser").Sync



' Function Sync
' -----------------------
' Supply default method that returns immediately, to be used in the Frame test object.
' Returns - True.

'@Description Waits for the  test  object to synchronize
'@Documentation Wait for the <Test object name> <Test object type> to synchronize before continuing the run.
Public Function Sync(obj)
   wait(1)    ''Updated by surya on 05/19/2008
  
   Sync = True
   If obj.Dialog("text:=.*").Exist(1) or obj.Dialog("nativeclass:=#32770").Exist(1) Then
       Exit Function
   End If
   If obj.WinStatusBar("nativeclass:=msctls_statusbar32").GetROProperty("text") = "Done"  Then
       wait(1)
   End If
   obj.WinStatusBar("nativeclass:=msctls_statusbar32").MouseMove 1,1
   sText = obj.WinStatusBar("nativeclass:=msctls_statusbar32").GetROProperty ("text") '.WaitProperty "text", "Done", 1000

   If INStr(sText, "http") <> 0 Then
       wait(1)
       obj.WinStatusBar("nativeclass:=msctls_statusbar32").MouseMove 1,1
       sText = obj.WinStatusBar("nativeclass:=msctls_statusbar32").GetROProperty ("text") '.WaitProperty "text", "Done", 1000
   End If
   While obj.WinObject("regexpwndclass:=msctls_progress32", "object class:=msctls_progress32","nativeclass:=msctls_progress32").Exist(1)
   Wend
   iWaitTime = 5000
   i=1
   While (InStr(sText, "Opening") <> 0 or InStr(sText, "Downloading") <> 0 or InStr(sText, "Applet Grid Started") <> 0 ) and i<iWaitTime
        obj.WinStatusBar("nativeclass:=msctls_statusbar32").MouseMove 1,1
       sText = obj.WinStatusBar("nativeclass:=msctls_statusbar32").GetROProperty ("text") '.WaitProperty "text", "Done", 1000
       wait(1)
       i=i+1
   Wend
   'Applet Grid Started
'  obj.WinStatusBar("nativeclass:=msctls_statusbar32").WaitProperty "text", "Done", 1000
  
End Function
RegisterUserFunc "Browser", "Sync", "Sync"