Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..
275 views

JavaTree - Select a Node by its Index

Jump to solution

Hi,

I'm having trouble selecting a JavaTree Node by its Index. According to the UFT (14.53) help document, the select method has the following syntax:

object.Select(item)  Where item is either the path of the node or its index value in the format "#N"

This statement works:

JavaWindow("Window").JavaTree("Tree").GetItem(4)

It returns the path of the node I'm interested in. This works too:

JavaWindow("window").JavaTree("tree").Select <path_of_the_node>

However, this does not work :

JavaWindow("window").JavaTree("tree").Select "#4"

I'm getting a "The statement contains one or more invalid function arguments" error message.

Am I misunderstanding something?

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: JavaTree - Select a Node by its Index

Jump to solution

You need to specify the path to the node, not only the index of the node

ex.  JavaWindow("SwingSet").JavaTree("TreeDemo$1").Select "#0;#4" 

The path is a list of the names or index values separated by the separator character specified in the Tree view path separator option in the Java pane of the Options dialog box.  Default separator value = semi-colon (;)

View solution in original post

0 Likes
2 Replies
Highlighted
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: JavaTree - Select a Node by its Index

Jump to solution

You need to specify the path to the node, not only the index of the node

ex.  JavaWindow("SwingSet").JavaTree("TreeDemo$1").Select "#0;#4" 

The path is a list of the names or index values separated by the separator character specified in the Tree view path separator option in the Java pane of the Options dialog box.  Default separator value = semi-colon (;)

View solution in original post

0 Likes
Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Re: JavaTree - Select a Node by its Index

Jump to solution

Hello,

I get it, thanks for your answer. 

But then it's more cumbersome than using the list of names. I was trying to find a way to easily select a node while knowing nothing about the structure of the tree and therefore avoid having to parse the whole thing. I don't see the real use of that index then if it cannot be used to directly select the node.

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.