| || |
, 09-14-2015 at 10:26 PM (814 Views)
Scratching your head because QTP/UFT doesn’t identify objects in Application?
If yes, then how to solve this problem?
From many years I am using the below options to solve most of the problems related to identification of an object, If you are in a similar problem I suggest you to ask the below questions to yourself and try to get the solutions as explained below:
1. I Know I opened QTP and Application but are they opened in the way it needs to be?
First check should be to make sure that QTP was opened before the application under test. Otherwise all objects will be identified as WinObjects.
2. Is all my add-ins right?
Check whether required Add-ins are selected or not.
If QTP is only recognizing your objects as standard WinObject this may be a sign that you need to use a proper add-in. Add-ins should be as per the application built technology.
For Ex: For Web applications: Add Web add-in and If you have Java Objects in application do add Java Add-in too,
And for Window Applications: Add Window Add-in
Note: Adding all add-ins at a time is not the solution, too many add-in will make script performance go slow. Add only suitable/required ones
3. Is my OS/Browser are compatible with your version of QTP/UFT?
Is browser Version you are using is compatible with QTP/UFT version?
To know this you should check with respected QTP version’s “Product Availability Matrix” and let’s say you found that your browser is not compatible then See if there is a QTP patch from HP that can help you. By installing required patch you can make the QTP work with your browser.
Refer: http://support.openview.hp.com/selfsolve/patches for more (you’ll need an HP ID for this)
4. No, it’s not easy to solve it, it’s difficult. Then what’s Next?
After above 3 checks are alright but you still have the same issue then don’t give up now it’s good challenge please research the issue.
How to research?
For this kind of issues I recommend below solutions.
I. Identification properties and methods:
Use object spy and Look at all the available object’s operations (both the “identification properties” and “native properties” methods). You’ll be surprised to see plenty of properties or methods while doing it.
II. Native Methods:
You can try out the Native methods of any object by writing .Object (Write Dot Then Write Object) after the object and then calling the required method.
For Ex: Browser(“name:=Google”).Page(“title:=Google”).Obje ct.getElementByID(“XXXX”).Value=”QTP”
Same as the above, you can also use the native methods of .NET/Java/other types of applications. If you are automating a .NET Application, you can try using the .NET Object spy which exposes the native methods of .NET.
III. UFT Insight object :
If you are using UFT, then you got option to use Insight which uses Image based identification to perform operations. You can click or type on an Insight object. (Check UFT help file to know more on Insight object)
IV. SendKeys/Device Replay :
If you don’t want to get head ache by trying each possible methods then Just go ahead and use WshShell object and use sendkeys/device replay to solve.
For more details about sendkeys, you can refer – http://msdn.microsoft.com/en-us/libr...(v=vs.84).aspx.
Note: This may not be a very reliable way of automation as we need to make sure about the focus of the application for these methods to work. So please use Activate/Highlight before sending the keystrokes.
V. Use Methods like GetvisibleText,GetTextLocation,ClickonText :
You can try using any of these methods if you are not able to perform an operation with conventional methods:-
object.GetVisibleText - It will get you the text which is visible to you of the object you mentioned, you can also use this if you are not able to use GetROProperty(“text”)
This will return the Left,Top,Bottom and Right coordinates of the text that you will give.
For Ex: strFound =Window(“”).Dialog(“”).GetTextLocation (“OK” ,left,top,bottom,right)
You can use this to click on any given text on an application, if you are not able to identify the specific object but you know the text written on the object then go ahead and use this
Syntax : ClickOnText(TextToFind, Left, Top, Right, Bottom, MatchWholeWordOnly,ButtonToClick,DoubleClick)
For Ex: Window(“”).Dialog(“”).Clickontext OK”,x1,y1,x2,y2,true,micRightbtn,false
5. I am tired; I did try all options but no luck so what to do now?
After above 3 checks are done but you still have the same issue then don’t give up now it’s challenging for automation group people, do check with them.
This is turning out to be a good research topic now so do involve automation group. You are not alone now, To help on your Research there are people to help – Please Check QTP Forums like SQA Forum, It is full of people who might have got the same problem as you, checking out these websites may help you. (I am doing this from last 7 years and I can say most of the time I get my answers/hint from here)
6. Still No luck?
Remember some time we need to treat Application Developer as Automation Tester’s Friend (Not Always: P Just Kidding)
You can also take the developer’s help if your application has objects with Custom classes. Ask your application developers to expose a method or add a property that will make automation easier. But before you ask, make sure you’ve exhausted all the above suggestions. I worked with some awesome programmers, and as long as I’m able to clearly explain to them what I need and why I need, they never hesitate to help.
For Ex : In one of my project I faced issues in identifying list boxes in grid and guess what my app developer gave me some methods and it did worked and these are never heard by QTP folks as we focus only on properties and methods we see through QTP object spy.
Most of the time by trying all the above options we get solutions, but there can many more options to try out as there is no defined process to solve these issues.
These kinds of solutions are found in researching for particular issue and the same helps us in automation.
Good luck all, Keep having fun with QTP/UFT