Our client is using third-party controls that QTP cannot identify (QTP can identify the menus but cannot identify the menu items). I searched the web for ways to combat this issue and found that people were creating their own custom libraries and using that in conjunction with QTP to identify objects.
I was thinking of creating my own dll that would get a unique identifier of a menu item (such as the name) and get the coordinates of the menu item so that I could pass those coordinates to QTP which could then click the menu item. I am planning on creating my dll in Visual Studio C# 2010 Express.
So, my question is, would this be a logical way to go about this problem and if so, where would I get started. Or is there a more efficient method? Any responses and comments are greatly appreciated. Thanks in advance! [img]/images/graemlins/smile.gif[/img]
This is a follow up to my previous question. I ended up creating a class library that uses UI Automation that retrieves the name of the element and gets its boundingrectangle property in order to calculate the coordinates of the element. Getting started, I planned what I needed to do and came up with the following steps:
1 - How to retrieve the element name and its properties
2 - Calculate the element's coordinates
3 - Return results
Using the UI Spy (in Windows SDK) to spy on my elements, I discovered that I had to traverse firstly to the window that held the elements, then to the element's direct parent and finally to the element itself.
Knowing little about UI Automation, I searched both the web and MSDN and finally found a page pertaining to the RootElement property of the AutomationElement object. From there, I relied heavily on the resources of MSDN and created my library.
If you are looking for code on how to do this or something similar, I suggest that you look up the AutomationElement.RootElement Property on MSDN or better yet look at their articles regarding UI Automation.
As Raj said QTP's add-in extensibility might serve your problem. I have worked on extending the QTP's functionality in recognizing some of the web controls (using web extensibility mechanism) which QTP fails to identify earlier.Please have a glance at the tutorial for Java add-in development in QTP.