cancel
Showing results for 
Search instead for 
Did you mean: 

How to find the objects that don't have unique values?

SOLVED
Occasional Contributor

How to find the objects that don't have unique values?

I want to map the objects from this tree view. The problem I see that their values don't seem to be reliable. See the attached screenshot. I tried the FindChild method, but it sometimes finds the sought-for object and sometimes doesn't.

 

var microStationFloatingHost = Aliases.OpenRoadsDesigner.HwndSource_WpfMainWindow;

var propNames = new Array ("ClrFullClassName","ChildCount"); 
var propValues = new Array ("Telerik.Windows.Controls.RadTreeView", 2);
depth = 0;
counter = 1; 
do
{
depth++;
counter++; 
var treeView = microStationFloatingHost.FindChild(propNames, propValues, 50, true); 
if(counter > 50)
{
break;
} 
}while(!treeView.Exists) 

Is there a way to deal with such dialogs? 

 

I have also attached a video that shows the steps I want TestComplete to do automatically.

 

Thanks,

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Leader

Re: How to find the objects that don't have unique values?

Hi,

 

I can think of such solutions/thoughts:

 

1) At the start, open the whole menu and use the txt recognition function in TestComplete to locate the corresponding item.

 

2) When you scan an element called 'locatePoint.dgn', in the 'childCount' property you have the appropriate number of child entities (10). Check with .find() whether it returns the correct objects.

 

3) When you scan an item called 'locatePoint.dgn' there is a 'Items' property -> press [...] and see what is inside. Maybe there is a list of objects ready to be read.

 

4) One of the simplest solutions is to navigate the tree with up and down keys and read the object name element (if it exists) and perform operations after finding the element.

 

5) You can also use ImageRepository in the critical case.

 

Let me know if you need more information.

 

View solution in original post

3 REPLIES 3
Highlighted
Community Leader

Re: How to find the objects that don't have unique values?

Hi,

Instead of childcount try the ordinalcount that is there with the element. So in your case you can find the control first which is the treeview and then use the findchild for it to search using the classname and ordinal number to go to the exact item. 

Highlighted
Community Leader

Re: How to find the objects that don't have unique values?

Hi,

 

I can think of such solutions/thoughts:

 

1) At the start, open the whole menu and use the txt recognition function in TestComplete to locate the corresponding item.

 

2) When you scan an element called 'locatePoint.dgn', in the 'childCount' property you have the appropriate number of child entities (10). Check with .find() whether it returns the correct objects.

 

3) When you scan an item called 'locatePoint.dgn' there is a 'Items' property -> press [...] and see what is inside. Maybe there is a list of objects ready to be read.

 

4) One of the simplest solutions is to navigate the tree with up and down keys and read the object name element (if it exists) and perform operations after finding the element.

 

5) You can also use ImageRepository in the critical case.

 

Let me know if you need more information.

 

View solution in original post

Highlighted
Community Manager

Re: How to find the objects that don't have unique values?

Thank you for a lot of useful advice Community!

 

Hi @harshad_w, did the suggestion help?  


Sonya Mihaljova
Community and Education Specialist

 Join the virtual SmartBear Connect user conference on April 27-28! Get your free virtual ticket today!