cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to handle dynamic object in desktop application

SOLVED
Occasional Contributor

Not able to handle dynamic object in desktop application

Not able to handle dynamic objects

Trying to identify objects the in popup. wanted to click on the ok button in the popup.

 

using the below script to find the children of the window... but it is not returning anything.

 

function OpenPatientWn()
{
var GenieObjMain = Sys.Process("Genie Client").Window("C:\\Genie\\Client", "Genie", 1);
GenieObjMain.Keys("^o");
var w = Sys.Process("Genie Client").Window("_ASI_THREED_SAVEBITS_", "Patient: 0 of 483 Records - Current User Preetha", 1);


// Specify the sought-for property names
PropArray = new Array ("WndClass", "Enabled");
// Specify the sought-for property values
ValuesArray = new Array ("Button", true);

// Find all enabled buttons in the Replace dialog
buttons = w.FindAllChildren(PropArray, ValuesArray, 5);


// Log the search results
if (buttons.length > 0)
{
for (var i = 0; i < buttons.length; i++)
{
Log.Message(buttons[i].FullName);
Log.Message("Total number of found enabled buttons: " + buttons.length)
}

}
else
Log.Warning("No enabled buttons were found.");
}

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Not able to handle dynamic object in desktop application

Based upon your screenshot, note that the ChildCount of the window that you have designated is "zero".  This means that there are no recognized child objects so FindAllChildren won't find anything.  This tells me that a) the window you are highlighting is not, technically, the parent of the buttons you are trying to find or b) that the buttons you are trying to find are contained in some sort of object that is not exposed to TestComplete.

What happens when you try using Object Spy on the OK button itself, just as an investigation tool to determine where it lands in your hierarchy so you can properly look for it.

 

Item of note... you are using NameMapping based upon the screenshot (MappedName property is non blank) so some of the first lines of your code can be restructured to use that Alias rather than the name value of Sys.Process.blahblahblah...

 

 

 

 


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available

View solution in original post

4 REPLIES 4
Community Hero

Re: Not able to handle dynamic object in desktop application

Based upon your screenshot, note that the ChildCount of the window that you have designated is "zero".  This means that there are no recognized child objects so FindAllChildren won't find anything.  This tells me that a) the window you are highlighting is not, technically, the parent of the buttons you are trying to find or b) that the buttons you are trying to find are contained in some sort of object that is not exposed to TestComplete.

What happens when you try using Object Spy on the OK button itself, just as an investigation tool to determine where it lands in your hierarchy so you can properly look for it.

 

Item of note... you are using NameMapping based upon the screenshot (MappedName property is non blank) so some of the first lines of your code can be restructured to use that Alias rather than the name value of Sys.Process.blahblahblah...

 

 

 

 


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available

View solution in original post

Community Manager

Re: Not able to handle dynamic object in desktop application

Hi @Preetha,

Does tristaanogre's suggestion help you resolve your question? 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Occasional Contributor

Re: Not able to handle dynamic object in desktop application

The buttons I am trying to find are contained in some sort of object that is not exposed to TestComplete. Hence I am using x y coordinate to perform the click action. didnt find any other way Smiley Sad

Community Hero

Re: Not able to handle dynamic object in desktop application


@Preetha wrote:

The buttons I am trying to find are contained in some sort of object that is not exposed to TestComplete. Hence I am using x y coordinate to perform the click action. didnt find any other way Smiley Sad


The aplication name you have is listed as "genie client".  IS this a terminal software, serving up aremote application?  That may be the eason for the situation your running into.

 

Something you can attempt is to use the Text Recognition feature to be able to find the different components based pon their text labels.  That MIGHT work for you.  Research it and see if it helps.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors