Hi Frnds,

I'm facing an unexpected situation while running my script with QTP11, win 7 and IE9.

What script does is takes input from an excel and puts the data in excel in an application and verifies it later. Now while putting the data in Application, if an invalid value is entered, an error in the form of dialog box is generated. So while automating, we took care of this and created a function which checks for DialogBox at specific points as well as as part of recovery scenario to handle any unknown issues( errors in form of dialog box or anything else ). Following is the function :

Public function getAlertMessage

'check Browser version
bver=Browser("CreationTime:=0").GetROProperty("ver sion")
'Check whether any Alert window is present
If Browser("CreationTime:=0").Dialog("is child window:=False","is owned window:=True", "index:=0").Exist = False Then
'if no alert, return Null
getAlertMessage = ""
If instr(bver,"Firefox") Then
'Firefox alert message
getAlertMessage = Browser("CreationTime:=0").Dialog("is child window:=False","is owned window:=True" , "index:=0").Page("index:=0")_
.WebElement("html id:=info\.body","html tag:=DESCRIPTION").GetROProperty("innertext")
''Internet Explorer alert message
getAlertMessage = Browser("CreationTime:=0").Dialog("is child window:=False","is owned window:=True","regexpwndclass:=#32770", "index:=0")_
.Static("window id:=65535").GetROProperty("text")
End If
End If
End Function

Now problem is Most of the times, this code works but some times this code doesn;t works and the execution of current row in excel fails and QTP moves to next line in row.

Also, whenever this code fails, recovery scenario function again tries to call this function so that text of the dialogbox could be captured ( if there is any ) and then throws in the following fashion :
Error Details --> Object Exist: False; MethodCall: GetROProperty; InputArgument : ,text

where as the recovery scenario function line are like this :

Function ObjectRecovery(Object, Method, Arguments, retVal)
If cmtErr="" Then
cmtErr="Error Details --> Object Exist: " & Object.Exist&"; MethodCall: "&Method&"; InputArgument : "
For each argmt in Arguments
End If
Call AddUpdateColumnToLocalSheet("Comments",cmtErr)
End Function

Please HELP as i'm not able to understand why getalertmessage() function works most of thee times but doesn't work during others.

Thanks in advance [img]/images/graemlins/smile.gif[/img]