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

Popular posts from this blog

Some good Resources / Blogs / Sites for Selenium Users

Here I have listed out some good blogs and sites by extensive selenium automation users. Hope these will help you a lot. http://automationtricks.blogspot.com  - by NirajKumar http://www.theautomatedtester.co.uk/ http://testerinyou.blogspot.com   - by Naga/Mathu http://seleniumready.blogspot.com  - by Farheen Khan http://seleniumdeal.blogspot.com/  - Amit Vibhuti http://seleniumexamples.com/blog Sauce Labs and BrowserMob are companies doing cloud and extensive selenium automation services, products, etc http://saucelabs.com/blog http://blog.browsermob.com http://testingbot.com/ Cedric Beust -  creator of the TestNG Java testing framework. http://beust.com/weblog/ http://blog.reallysimplethoughts.com/  - by Samit Badle, Created many Selenium IDE Plug-Ins Available Colud Testing: 1. SauceLabs 2. Soasta 3. BrowserMob 4. CloudTesting.com  etc. Selenium Testing Products: 1. Twist by ThoughtWorks 2.  TestMaker by  PushToTest 3. Element34 company providi

UFT - Take full page screenshot by scrolling the page

'######################################################################################## 'This is navigate through the full page and taking individual screenshot of visible area '######################################################################################## Function TakeScreenshot Dim intScrolls, intScroll, strScrollPos Set pgApp = Browser ( " " ) .Page ( " " ) intScrolls = Round ( pgApp . RunScript ( " document.documentElement.scrollHeight / (screen.height) " ) , 2 ) If intScrolls < 1 Then intScrolls = - 1 pgApp . RunScript " window.scrollTo(0, 0); " Wait 1 Browser ( " " ) .CaptureBitmap " C:\screenshot0.png " , True For intScroll = 0 To intScrolls If Environment . Value ( " Browser " ) = " CHROME " Then strScrollPos = " scrollY " Else strScrollPos = " document.documentElement.scrollTop " End If If p

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 End   Function 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