Skip to main content

QTP - Common error messages

Always I am seeing  many of my friends asking for help if any error occurs while running script in QTP without googling for help. How much troubleshooting you guys are doing will directly reflect your knowledge on the tool. I agree, no one knows each and every error occurs in the software. But we can improve our knowledge by googling and doing workarounds...
Whenever the question "How much level you know QTP?" arrows me, always I am comfortable with the answer "below 10%". But after answered, my mind will have an inner thought like, What are the things I have to learn to fulfill the answer I have told because I never used lot of features in QTP.

Here I am listing out some of the errors, situations and what might be the original issue things etc. I hope this will give you some ideas to improve your debug ability and to solve your errors. Kindly correct me If I am wrong in any point.

Type mismatch:
- Mostly doing operations with different data types without doing type conversions
- Whenever the mentioned object or function not available in the code with respect to QTP knowledge. You might forgot to associate the function lib or renamed of the function.

Parameter is Incorrect:
- The data to be inserted or set in the object will have extra length. i.e. above the design limit of the test object.
Ex. Mostly while setting some value in edit box, we will get this error because we are trying to set the value with 50 chars in the edit box designed to handle max 30 chars.

UnExpected ):  
- Mostly fresh QTP coders will see this error. Whenever trying to call a function, use parenthesis only if you are going to get the returned value from the called function. 
- If you are not going to get the return value, then just mention your parameters without using ().

No. of parameters mismatch:
- Here you could have missed to mention all the parameters for your function.

More than 1 object is matching...:
- Here QTP identifies more than 1 object with the mentioned properties and got confused which one to handle. You need to give additional properties to identify your object uniquely. Sometimes index will give you hand.

Out of bound error:
- When you are trying to get the values from an array position which is not declared or assigned or not available.

Name undefined:
- You should have mentioned Option Explicit to force the variant declaration but you forgot to add the declaration for the variant.

Name redefined:
You should have mentioned Option Explicit to force the variant declaration but you declared the variant which is already declared.

Object Required:
Sometimes we will try to get an object from long hierarchy if its not identifiable easily. At this time, if any mid way object is failed in identification, QTP will throw this error.
Ex. While trying to get the object inside the WebTable, QTP will throw this error if webtable itself not identified.

General Run Error:
- Say you have function in your vbs file like Function abc(a,b) and from your test you are trying to call like If abc(a) Then. Here QTP will raise this type of error.
- And also some places where QTP not able to identify which type of error.

I will keep adding the errors I have faced and known to my knowledge. Definitely every one will face lot of errors. Kindly share the same here so that I will add those too for every one's reference.

Comments

  1. Ahh…finally, after so much of scavenging…here it is...I have been desperately looking for this info from past few months…I am sure this would help me a lot…..I never thought the solution for my nagging question is so simple…Or probably you are damn intelligent to explain such a complicated thing in a simple way..Thank you again!!
    Automation

    ReplyDelete
  2. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium

    ReplyDelete

Post a Comment

Popular posts from this blog

Change IE Browser ZOOM settings

Lot of UI automation testers could have faced this problem as we could change the zoom settings while operating manually for our convenience and forgot to reset to 100%.
But our QTP and some other related tools would operate the browser perfectly if browser zoom is 100%. So wee need to change the zoom before start to run the scripts. Its better to have a code snippet in our framework to change this zoom setting right?
Here we go...

1. We can simply change the Registry values before Invoking IE
Function ChangeRegistry Dim objShell Set objShell = CreateObject("WScript.Shell")  objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Zoom\ZoomFactor", "100000", "REG_DWORD" Set objShell = Nothing EndFunction This option is very useful. But in real time, lot of customers could have restricted write access to windows registry. So we can try other options.

2. Use IE COM object and Change Settings
Function ChangeIEZoom Dim intZoomLevel, objIE  intZoo…

QTP - Object Identification - Prerequesties

While starting a new project or proof of concept or after new QTP installation, we would face the issue in identifying objects as QTP built objects like WinList, WebEdit, etc.; instead everything will be identified as WinObject.

Here are some steps to ensure you did the environment setup RIGHT before start automating.
Did you enabled required Add-ins only while launchingDid you selected "Record >> Record and Run Settings" - This should be based on what type of application you are working with
Windows app - Windows >> Record and run test on any windows applications. Web app - Web >> Record and run test on any open browser.
Did you tried to launch UFT/QTP and then AUT.If its web, ensure browser zoom level set to 100%Try disabling the protected mode in IE for web.Launch UFT and AUT using RUN AS ADMINISTRATORAlso see the Object Identification Methods if you are interested.

Run JavaScript from QTP

Yeah, You can run your pure JavaScript from QTP using RunScript method. Lot of times, we are in need of firing events or simulating actions on web page which is not supported by QTP. At that time, you can use your direct DOM methods and directly execute your script on the web page from QTP like,
Dim MyPage, SearchBox Set MyPage = Browser("title:=Google").Page("title:=Google") Set SearchBox = MyPage.RunScript("document.getElementsByName('q')(0);") SearchBox.Value="testing"
'if objects available in frames, Set SearchBox = MyPage.RunScript("document.frames(4).document.getElementsByName('q')(0);")
'OR
Set objFrame = Browser("title:=Google").Page("title:=Google").Frame("title:=something")
objFrame.RunScript("document.getElementsByName('q')(0);") Also, you can execute by obtaining actual browser window object if you have IE app like, Dim IEApp Set IEApp = CreateObject("Internet…