07-20-2009, 03:23 PM
Hi Martinangello,
Please find the below function which will work well only by passing the browser and page names.
Eg: f_waitForPage "x","x"
Let me know if you need any more information.
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.
Thanks,
SUpputuri
SUpputuri