The following function is written to handle popups on browser windows by clicking Yes or ok button on pop up windows:
Public Function CleanBrowserPopUps(Obrowser)
'Get the Pop Up Dialog
Set OPopDialog = Obrowser.Dialog ("ispopupwindow := True")
CleanBrowserPopUps = False
msgbox (OPopDialog.Exist(0))
If OPopDialog.Exist(0) Then
'There is a popup dialog
'Get its title
spoptitle = OPopDialog.GetROProperty ("title")
Select Case Lcase(spoptitle)
Case "security information", "security alert", "security warning", "error"
'Enter a OK button would be there or a Yes button
OPopDialog.WinButton ("text := (&Yes|OK)").Click
CleanBrowserPopUps = True
Case Else
msgbox ("Unknow Dialog Box - " & spoptitle)
End Select
End If
End Function
A new sync function is written for the browser and page
Public Function NewSync (Oobject)
If Oobject.GetToProperty("micclass") = "page" Then
Set obrw = Oobject.GetToProperty("parent")
Else
Set obrw = Oobject
End If
'sync
Oobject.sync
CleanBrowserPopUps(obrw)
'Resync
Oobject.sync
End Function
Then registered the above function:
RegisterUserFunc "Browser", "Sync", "NewSync"
RegisterUserFunc "Page", "sync", "NewSync"
then tested using code below:
WebUtil.DeleteCookies
systemutil.CloseProcessByName "iexplore.exe"
Systemutil.Run "iexplore.exe", "ANY URL"
wait 10
Browser("CreationTime := 0").Sync
Can you please tell why the code above always fails at line Oobject.sync