Micro Focus QTP (UFT) Forums
Sync points - 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: Sync points (/Thread-Sync-points)



Sync points - fran101 - 06-28-2012

Hi,

I'm trying to use sync points in my tests but i've put the sync in a function and tried to make it as generic as possible to be able to use it in different tests on different pages. My function looks like this:

Code:
Function SyncBrowser
    
    Browser(".*").WinStatusBar("msctls_statusbar32").WaitProperty "text", Done, 10000

End Function

It is supposed to wait untill the status bar in the browser says "Done"

when I run the test it keeps complaining that the object is not in the repository even though i've added the object to the repository for each of the browser pages that i will be running my tests against.

I have also tried
Code:
Browser("title:=.*").Page("title:=.*").Sync

and
Code:
Browser("title:=.*").Sync

In tests where possible I have used .Exist(10) but this is not always possible

I would be greatful for any ideas or suggestions.



RE: Sync points - supputuri - 06-28-2012

Replace the code in your function with below
Code:
'Assumption you will have only one browser
Do until Browser("CreationTime:=0").Object.StatusText = "Done"
     msgbox Browser("CreationTime:=0").Object.StatusText
    wait 1
Loop



RE: Sync points - Shridevi.Salagare - 07-04-2012

You can use this code to avoid the script getting in the infinite loop in case the page is not displayed.
Code:
Function Page_exist
   intcount=0
Do     
    strStatus =Browser("title : = ").Object.StatusText
    intcount = intcount +1
    If intcount = 100 Then
        Exit Function
    End If
    If instr(strStatus ,"Done")> 0 Then
        Exit function
    End If
    wait 1
Loop While instr(strStatus,"Done") < 1
End Function