Sep
24
2008
--

General run error when clicking on button

General run error are hard to debug and any extra information available to fix the issue is always helpful. Sometimes QTP starts throwing General run error in click events of WebButton. Digging into the source of the issue using the technique mentioned in Debugging General run error we would see a “Element not found” error in the debug pane.

When you check exist on the button it would still return True but the click would throw a general run error. I have not been to formalize what causes this issue but there is a small dirty workaround to fix

Browser("Browser").Page("Page").WebButton("Login").Highlight
Browser("Browser").Page("Page").WebButton("Login").Click

Note: You should only use this workaround in case you are getting a general run error. This should never be used as a practice

Rating: 7.1/10 (7 votes cast)
Mar
29
2008
0

Debugging general run error

So you got a General run error while running your code and are not sure on what to do?

What does General run error mean?

General run error occurs when an underlying source being accessed by QTP throws an error. QTP instead showing the error text shows a “General run error”.

General run error

General run error

A typical example would be the below line of code

Set oGeneralRunError = GetObject("X.Y.Z")

Running the above code would generate a general run error. But running the same code in VBSript would generate the below error

Invalid syntax error

Invalid syntax error

So the actual error is Invalid Sytax and not the “General run error”. To look at the actual error in such a case, click on the Debug button and open the watch window. Type the below in the Watch window

DescribeResult(Err.Number)
Using DescribeResult to get the Actual error

Using DescribeResult to get the Actual error

How to fix general run error ?

  • If you are getting this error while working on a QTP test object, then put a Msgbox to check the existence object being worked upon
  • In case of Web environment using DOM object methods could be of the solution
Rating: 7.0/10 (6 votes cast)