Micro Focus QTP (UFT) Forums
Recovery scenario function call setup - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Recovery scenario function call setup (/Thread-Recovery-scenario-function-call-setup)



Recovery scenario function call setup - pranjal - 09-15-2009

Hi,
I need help setting up a recovery scenario for my login screen.
The qtp script is as follows:
Code:
SystemUtil.Run "iexplore.exe", url,"", "open"
With Browser("browser").Page("page")
.WebEdit("username").Set username
.WebEdit("password").SetSecure password
.WebButton("GO").Click
End With

Browser("browser_2").FlexApplication("portal").FlexButton("button").Check CheckPoint("buttoncheck")

Now, if I comment out .WebButton("GO").Click to replicate the error when the login fails and FlexButton("button") is not visible, I can see the error popup that QTP throws - "Cannot find the "button" object's parent "portal" ...." Run Error with 4 options: Stop, Retry, Skip, Debug.

I have set up a recovery scenario which identifies this popup and clicks on the skip button, then calls a function. it works fine upto this point.
In this function, I would like to capture the screenshot and close the browser. I get 'Unspecified Error' in this operation.

In my post recovery option, I have set it to 'Restart current test run'

The function looks like this:
Code:
Function LoginErrorRecovery(Object, Method, Arguments, retVal)
Browser("creationtime:=.*").close
msgbox "browser closed"
End Function

Is there a better way to deal with such situations? i am open to try out different approaches. Also, how can I utilize (Object, Method, Arguments, retVal) ?

please help. thanks in advance.


RE: Recovery scenario function call setup - Ankur - 09-15-2009

This looks like a case of error handling and not exception handling.

For taking a screenshot you can use .CaptureBitmap method.

The various strings in brackets are simply the arguments that you pass to a function. Probably you can brush-up knowledge on the user defined functions in VBScript