Dynamic Object Recognition and how to use FindChild in Keyword test
Hello, everybody. I am currently assessing TestComplete as a replacement for another Automated test tool which is becoming more and more cumbersome.
I have only a short time to complete my assessment before I have to return to "real" work and will have no opportunity to continue.
Please excuse me if I am missing the obvious as I am trying to rush things through a bit, sorry.
My boss will not allow us to use User Code as she feels this makes our tests difficult to maintain. Most of our testers have no programming background.
Consequently, I am trying to use Keyword Testing as much as possible. I have two problems, which I believe to be interrelated.
1. We have dynamically generated popup menus. In the other tool, we could supply a variable against one of the properties (text) to find the menu item we wanted to click. In my current keyword tests, I find an apparently fixed index number. I have read this article Testing-with-a-dynamic-built-menu-structure which indicates the use of the FindChild method may solve my issue but I would like a (pictorial?) example of how this would look in TestComplete. Step by step would be great.
I have attached a screenshot of the menu I want to be dynamic.
2. In a similar vein, we often have a number of objects which are dynamically placed on screen, and, in the other tool we can, again, reference these using a property such as caption which is linked to a variable at run time. I have tried using a variable against a property for these objects but at runtime, the value of the variable seems to be ignored and I get the object which was originally recorded. I wonder if FindChild will also solve this problem.
I have attached a screen shot of what I tried but even when I change the variable StepNumber1 the object selected is the same.
Many thanks in advance.
Regards to all.
Hey - I have found a solution that I worked out with a suggestion from another Forum member.
Sub ClickPopup(Category,ItemName )
Dim MyDiagram
Set MyDiagram= Aliases.ClientHost.HwndSource_ProcessEditor.ProcessEditor.tabControl.myDiagram
Call MyDiagram.ClickR(223, 369) ' Will make this a parameter eventually
Call MyDiagram.PopupMenu.Click("New|" + Category)
Dim FoundEntry
Set FoundEntry = NameMapping.Sys.ClientHost.FindChild("text",ItemName,100) ' ClientHost is the application main window
FoundEntry.Click()
End SubThanks for the hints and help from rushikesh.