Object ID\'s changing
I am using below function in many windows or .Net Forms. The functionality is like click on a button pops up a dialog and i need to click cancel button on the dialog.
The object that pops up has object id as Object_2 sometimes and Object_4 (Seeing in the object browser). Is there a way i can generalise the script to take into consideration as to which object index it is using.
p = Sys.Process(aShell);
w = p.Object_2;
w.cancelButton.Click(30, 11) ;
It would be a great help if i could get this working. I have not worked much on TestComplete , so not much idea on what it should be doing.
Re: Object ID\'s changing
I guess you are working with TestComplete version 3. Please note that in TestComplete 4 and 5 this problem is solved by a new way of naming objects in .NET applications. You can find more about this in the following article on our AQCommunity blog:
[ QUOTE ]
The object that pops up has object id as Object_2 sometimes and Object_4 (Seeing in the object browser).
[/ QUOTE ]
This object's name relies on index that can change depending on the state of the tested application. To solve the problem, you can use one of the following approaches:
- Ask the application developers to specify a unique name for this object.
- Use the Window function in the script to get a reference to this object by its WndClass and WndCaption properties.