Description
Inserts a VBScript error into the test script.
Syntax
SetLastError(Error)
Example
The following example uses the SetLastError function to place the "Out of memory" error into the test script. For a list of VBScript errors, see the Microsoft VBScript Reference (Help > QuickTest Professional Help > Microsoft Windows Script Technologies).
Browser("Mercury Tours").Page("Mercury Tours").Image("Login").Click 11, -18
SetLastError(7)
Browser("Mercury Tours").Page("Welcome to Mercury").Image("Search Flights").Click
Description
Returns the error code of the most recent error. You can use this statement together with the DescribeResult Statement.
Syntax
GetLastError
Return Value
Number
Example
In the following example, the script fails to run successfully because the Login image was not found on the Mercury Tours page. Using the GetLastError function, the error number and description are inserted into a message box.
Browser("Mercury Tours").Page("Mercury Tours").Image("Login").Click 19, 55
x = GetLastError
msgbox(DescribeResult(x))
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.