JavaTree - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: JavaTree (/Thread-JavaTree--4882) |
JavaTree - perplexed - 05-20-2011 Suppose I have a JavaTree -Project --Node --City ---city1 ---city2 ---city3 ---city4 --xzm --BMM ---b1 ---b2 ---b3 --xx And I want to know how many nodes are under subtree City or BMM. And no of cities may vary depending upon the input. can some one please help me out. RE: JavaTree - perplexed - 05-25-2011 Come on ! NO one ? RE: JavaTree - lotos - 05-25-2011 hi perplexed, ok, so I will try to help with some ideas I think you should use a counter for that, I've used in next way: Code: ' get the row's count from the dropdown method where obj_DropDown was described before to use it (I think you know how to do that?!): Code: Set obj_DropDown = Browser("URL:=" & Environment.Value("baseUrl")).Page("URL:=" & Environment.Value("baseUrl")).WebList ("select type:=ComboBox Select", "name:=" & obj_Name) In my sample the URL is got from an XML file(it's the application's URL, you can insert it directly into the code, and the obj_Name is the name of your dropdown, for e.g.: Code: ' get the row's count from the dropdown P.S. and now play with IF statements to count the under subtree elements and to select the one you want (and to get the sub tree elements from it). Maybe you'll need a second counter for the elements under subtrees?! Hope that will help you! RE: JavaTree - perplexed - 05-31-2011 Thanks a lot Lotos. It helped. I have also written my own script that goes like this : Public Function findItemCount(ByRef levelID ) // levelID will be the level in the javatree. viz #0;#4;#4 or #i;#j etc. Code: Dim itemID RE: JavaTree - lotos - 06-01-2011 cool men, I am glad that my sample helped you! RE: JavaTree - Pindaruk1 - 06-20-2011 Hi Lotos, can you please help out with the code on, how to drag an object from one tree structure and drop it in another tree structure. We are working with java based application. Thanks in advance, RE: JavaTree - lotos - 06-20-2011 I think you should use the GetROProperty and assign the get value to a string which will be used in another part. I will try but not sure if it will work, you'll need to adapt the code a little, I does not worked with java applications, and I don't know which are the objects' properties and their values. See next: Code: Dim obj_Property1, obj_Property, obj_Property2, obj_Value1, obj_Value2 GetColumnValue returns the text from the specified column in the specified node in the tree. GetItem returns the value of the node specified by the index. Code: Public Function WebElement (obj_Property1, obj_Property2, obj_Value1, obj_Value2) I don't realy understand what do you mean by saying: to drop it in another tree structure. Maybe you mean to check if it exists under another tree?! RE: JavaTree - Pindaruk1 - 06-22-2011 Hi Lotos, Thanks a lot for your response. We have attached a screen shot for your understanding regarding the tree structure. We need to drag an element from one tree structure and drop the element in other tree structure. We will try with the code, that you have given and will get back to you. Thank You. |