Hello,
In HP's Unified Functional Testing, I am automating a test that interacts with an SwfTreeView Infragistics object, of type UltraWinTree. I am having great difficulty with getting UFT to run playback on this object. When I record an action on the UltraWinTree, the line "\\ObjectPath.ActivateNode "\ 1"" is recorded, no matter which node I select in the tree. Aside from this, I have been digging through the forums to identify how to select a particular node in the tree, and most of what I have found directs me to identify the correct node index, and then use this for UFT to point to the right node. This has not been possible thus far, because I am unable to identify the right path to a given node, other than with the information "\ 1", which will always point to the first node when I playback (despite UFT recording this for every node I select).
Once again I suspect that this is because in my assembly files for Test Automation for WinForms 2014.1, I do not possess the .dll for UltraWinTree. If the solution to this problem is indeed another installation package, then I would also need to be sure that it contains a .dll for UltraWinGrid, as I previously had issues with that Infragistics control (and the solution Infragistics support provided me with was a new installation package).
Thank you for any assistance,
Joseph
Hi Joseph,To investigate more on this case, I just wanted to know if you have the right version and build which is TA.QTP.Nightly_14.1.20141.2005. This is a re-release build of the version and not a patch. So this will have everything from the initial release and any added bug fixes until this release.
Thanks,Josheela
Josheela,
Thank you for attending to my issue. I looked into the files that I have for Infragistics, and it looks like I have version 14.1.20141.2005 for Test Automation. I saw this exact entry in the properties of the .exe for Version Utility. I should add that I saw no mention of "Nightly" though.
Thanks,Joseph
Each volume release of Windows Forms Test Automation for HP (Unified Functional Testing) software maps directly to the corresponding release of Infragistics Windows Forms. Therefore, Windows Forms Test Automation for HP (Unified Functional Testing) software 2014 Volume 1 is supported to work only with Infragistics Windows Forms 2014 Volume 1.So, can you please make sure if your AUT is referencing the 2014.1 dlls.
Sure, I looked again in the BIN folder of my AUT. I believe that these .dlls are version 2014.1, but just to make absolutely sure I'll post a few of their names as examples here:
Infragistics4.Win.UltraWinTree.v14.1Infragistics4.Win.UltraWinGrid.v14.1Infragistics4.Win.UltraWinEditors.v14.1
Hi Joseph,
What I imagine is happening here is that your nodes don't have "Text" or perhaps they all have 1 as their text but don't actually display it. Do you use just images for your Tree nodes? Another option is you can use the Tree node Key's. It doesn't record but you can get them in a number of ways. The easiest might be with UFT's .NET Windows Forms Spy under the Tools menu, or Ctrl+Shift+P highlight the Tree, then look for the Nodes collection, dig to the nodes, and look for the Key property. If you would rather do it in code, by using GetNAProperty("Nodes[0].Key"]. If you have several layers deep you may need to dig into the Nodes[0].Nodes collection, and continue from there.
Let me know if that helps,
Recently I discovered that the number "1" is actually based on a menu item selected which, when selected, loads the particular WinTree with data depending on what was selected. As I selected "2" in this menu, I recorded a series of 2's whenever clicking on a node. The content of each node is filled with a string in most cases, not just the single integer.
I do not think that they are images, the tree's nodes are filled with only text which leads me to believe this.
I attempted to get the node key by the ways you suggested. In the .NET Windows Forms Spy I made my way to the Node collection, but when I tried to access the collection by clicking the "..." button in the cell, there was a dialog message: "The nodes collection cannot be edited when there are bound nodes in the tree." I am not sure of what this means, but ultimately I cannot obtain the node key.
I also used the snippet you had, and when I tried to obtain a message box of the key there was no error, but the message box was blank. Any index aside from 0 in Nodes[] will throw an error saying that the node cannot be found.
They may not be images, it was just a thought based on the information that you provided. Out of curiosity you said you only got the first node, and it was blank. Are there nodes under that first node. If so what do those nodes look like and what if anything are there keys and text? As mentioned, you should be able to dig into those through a recursive loop like below. By default we record based on a path built on the .Text property. So it will be something like:"\\Root\Child\GrandChild"
But you can also access it directly by it's key if it has one, without having to build a path.
Let me know if this helps,
Set tree = SwfWindow("Root").SwfWindow("BaseTest").SwfTreeView("ultraTree1") values = "" Call GetAllNodesPropValue(tree, "Nodes", ".Key", values) Msgbox values Sub GetAllNodesPropValue(tree, nodesPath, propName, byref propNameValues) count = tree.GetNAProperty(nodesPath & ".Count") For index = 0 To count - 1 crntNode = nodesPath & "[" & index & "]" propNameValues = propNameValues & tree.GetNAProperty(crntNode & propName) & vbCRLF Call GetAllNodesPropValue(tree, crntNode & ".Nodes", propName, propNameValues) Next End Sub
Hmm, That's one method I hadn't thought of trying, and I am a bit leary of it. Setting the Key on a node to then use that new key to select that node. But actually trying it does work. I think the issue you are hitting is that you are prefacing the Select with a "\" the "\" tells IG TestAutomation that it is a path that it is looking for. Since you are passing in a key, you shouldn't use that.
So something like this should work:Set tree = SwfWindow("Root").SwfWindow("BaseTest_2").SwfTreeView("ultraTree1") tree.ActivateNode "\Value2" tree.Expand "\Value2" tree.SetNAProperty "Nodes[2].Nodes[2].Key", "MyKey" tree.Select "MyKey"
Let me know how that works for you,
This might call for a new forum post, but I thought that I might first raise this issue here. Now that I can verify information in a certain cell, I need to be able to select a certain node that is not necessarily the first entry in the table. I am able to set and get node keys, but when I try to select a node based on that key that I set, there is an error:
tree.SetNAProperty "Nodes[" & x & "].Key", "\ " & x 'used this format based on previously noted "\ 1"msgbox tree.GetNAProperty ("Nodes[" & x & "].Key") 'shows \ x appropriatelytree.Select "\ " & x 'lands me with "The following UltraTree Node [ x] was not found." in the error report
What can I do to properly select a node in this tree? Also I will add that when a get the key for a given cell, the column header is the returned value.
Mike,
Using this method I was able to obtain values throughout my WinTree object. Thank you very much for all of your feedback!
Thanks,Joe
That would explain the issue as well. Yes the UltraWinTree has a Grid Style. The record functionality on that seems to be limited. But there is a GetCellData method that should work for verifying data the way you would like. It uses indexes only to dig through the Nodes\GridRows. So something like:tree.GetCellData("\0\0","name")
Should return from the first node's first row, from the column with the key name the value of the cell.
Similarly you can use GetNAProperty or a derivation of what I posted before: msgbox tree.GetNAProperty("Nodes[0].Nodes[0].Cells[2].Key")msgbox tree.GetNAProperty("Nodes[0].Nodes[0].Cells[2].Value")
Thank you for your suggestions. The first node in the tree that I can access does indeed have a single child that can be expanded, and also accessed with .Select " \1\101322". 101322 has no correlation with the content of the parent or child node from what I can tell. In general, the entire object looks very much like an UltraWinGrid, but I suppose that having just a few expandable rows in this set of data is why the WinTree control was used. Each column of this "table" is either composed of strings or integers, one column has either an "X" or a blank space which functions as a check box in a way, but without a way to be edited from the GUI (just giving you an idea of the tree's contents). Ultimately, I'd like to be able to access the data of a particular "cell" in a node of the tree.
As far as obtaining the keys, I implemented the snippet you suggested. It compiled and ran successfully, but unfortunately once again the message box reported only blank results so I am still lacking the node values.
Thank you once again for your continued support.