what is the problem with the code below
Question ID: 105236
0
0

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

Marked as spam
Posted by (Questions: 45, Answers: 1)
Asked on January 30, 2014 4:52 am
132 views
Answers (1)
2
Private answer

After looking at your code, have you removed the extra space before the colon on the following line?

Set OPopDialog = Obrowser.Dialog (''ispopupwindow := True'')

You might want to check other lines for extra spaces.

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on January 30, 2014 4:53 am
0
How could I over look that.
( at January 30, 2014 4:53 am)
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top