Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to write a genecric function for sync operation
#2
Solved: 11 Years, 4 Months ago
Hi Martinangello,

Please find the below function which will work well only by passing the browser and page names.
Eg: f_waitForPage "x","x"

Code:
Public Function f_waitForPage(ByVal BrowserName, ByVal PageName)
Dim strSyncObject                           'to hold page object description
Dim intCounter                                 'to store loop counter value
Dim strSyncDone                                             'to store page existence value
Dim strSyncObjectDesc   'to store object description

'Any error is handled by the calling function
On Error Resume Next

'verify whether the page name is specified or not.
If PageName <> vbNullString Then
                Set strSyncObject=Browser(BrowserName).Page(PageName)
                strSyncObjectDesc = "Browser " & BrowserName  & ", Page " & PageName
Else
                  f_ReportFailure "Verify that the page", PageName& "Page is not displayed."
End If

'wait for the object in a loop, until the counter reaches the max
intCounter = 1
strSyncDone = strSyncObject.Exist
Do While Not strSyncDone
                Wait gWebPageSyncTime
                strSyncDone = strSyncObject.Exist
                If intCounter = 10 Then Exit Do End If
                intCounter = intCounter+1
Loop

'Error handling
If strSyncDone Then
                Browser(BrowserName).Sync
                f_waitForPage = micPass
Else
                f_waitForPage = micFail
End If

End Function 'End of 'waitForPage' function.
Let me know if you need any more information.
Thanks,
SUpputuri
Reply


Messages In This Thread
RE: How to write a genecric function for sync operation - by supputuri - 07-20-2009, 03:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Cross Browser Sync Not Working geodude 0 1,961 04-07-2017, 08:43 AM
Last Post: geodude
  Calling a function in a Test Script from a function library anupam4j 3 6,115 06-26-2015, 12:31 AM
Last Post: babu123
  How to use sync function 22sumit 2 3,478 06-16-2015, 06:27 PM
Last Post: 22sumit
  The DataTable.ExportSheet operation failed. Invalid file. Niraj 2 6,283 05-05-2015, 11:40 PM
Last Post: babu123
  Excel operation - to find usedrange of rows & col pooja 1 9,711 02-19-2015, 04:06 AM
Last Post: supputuri

Forum Jump:


Users browsing this thread: 3 Guest(s)