Forum Discussion
karthick7 wrote:
Hi ,
Find the label and get width and height
For example
TreeView.Click(label.width+10/2,label.Height/2);
another way,
Place selection on TreeItem,Press Space Key [Space],it will expand.
Regards,
Karthick Raj P
These are some good alternatives. However, we might be able to get this to work if we know what kind of TreeView it is. What is sounds like is that the treeview object is not being identified as a known component type.
This is the list of supported Angular JS controls. https://support.smartbear.com/testcomplete/docs/general-info/supported-technologies/controls/angularui.html
If your component is not one of these, then either go with karthick7 suggestion or see if we can map the object to something similar in your project object mapping (Tools | Current Project Properties)
Looking at the TC docs, Angular JS Trees are not supported directly.
But I had a look at an example one. The one on here: https://angular-ui-tree.github.io/angular-ui-tree/#/basic-example
... and I was able to interact with it easily enough. The tree itself shows as a top level control. All it's nodes show as child items. All text within the nodes was visible and I was able to search by it. And the clickable controls (expand, add, remove) within each node were all accessible and usable. I'd be happy I could build my own handler function to allow me to use them without too much trouble.
Of course, this is based on an example one I happened to find online. I have no idea if the one you're dealing with behaves the same way.
- Colin_McCrae8 years agoCommunity Hero
Same goes for this example one: http://www.jqueryrain.com/?KIVkhqxl
It was all there. Think they implemented it slightly differently as it was a little more awkward to interact with. But again, if I took the time, I could build my own handler for it.
Not all controls are supported and do everything you want out of the box. Sometimes you need to build your own solutions I'm afraid. This appears to be one of them. But, going by the examples I can find, it appears to give you all the properties and methods you should need to do exactly that.
- ameykhopade8 years agoContributor
yes, I can get the text of the top node but when I perform click action its not expanding.
the text in not clickable. even cant find any method which is related to expand.
- Colin_McCrae8 years agoCommunity Hero
What are you clicking on?
The first example I linked to, the expanders (the bit you need to click on) was a child object of the node.
The second example was a little more fiddly. You can still find the node using content text, but it's the little arrow on the left you need to click to expand it. This is not seen as a child object like in the first example. But instead, you just click half way up the height of the node and a couple of pixels in from the left and it expands as it's supposed to.
If your one uses clicks on the node directly (rather than an embedded child object), then you need to do something similar to the first reply. ie. get the co-ordinates of the node, work out the centre-point, and just apply a mouse click there. Similar to the second example. If it's the "+" in a box you need to click, get the left edge and centre point of the node , relative to the control container, and then move left a set number of pixels and that should click on the expander.
There will be a way of doing it. Might just need a little more thought than usual. All the elements seem to be there. You just need to work out a way of manipulating it if it's not giving you out-of-the-box methods you can use. Not all controls do. Another possibility may be to use keypresses to move around inside it. Depends if the active node is flagged in a way that you can detect. eg. Move down all nodes in a loop checking which one is active each time. When the one you want becomes active, hit enter, or space, or whatever key acts as a shortcut in your case.
Your second screenshot isn't very helpful without some context. I have no idea where that control sits. Is it a node? Is it a child of a node? Where does the top level container sit? And there are a bunch more properties cut off and we can't see any of the available methods ....
- ameykhopade8 years agoContributor
I need to expand the list and select one child object.
First I need to click on the "Routine" in the TreeView (attached Imange TreeView1.PNG) which will be expanded then I have to click on its child object "Field Notes" and then "national bridge Inventroy" and then select the last child item,(attached Image FullTreeView.PNG)
In this treeView Only the '+' sign in clickable
My goal is to select the last child item.
I tried using the Space click but its just refreshing the object.Trying for the coordinates.