problem with getting the number of children - 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: problem with getting the number of children (/Thread-problem-with-getting-the-number-of-children) |
problem with getting the number of children - Carol - 02-27-2008 Hi there, I have a chunck of codes that counting the children of a webtable Here is my code: Code: Dim obj_ChkDesc The MsgBox show me the num is "0" However, I do expect the num to be "1" Does any one know what is going on here? Many thanks Carol RE: problem with getting the number of children - deepakmehta82 - 02-27-2008 Hi Carol, The code that you have used is right for retrieving the child objects of the web table.The issue that i suppose is in the properties of the object "obj_ChkDesc" that you gave.Also,in place of "class" it should be "Class Name" in 3rd line.Your code is not able to find the child objects having the properties that you defined.So,there is problem in defining the properties of the child object. -Deepak. RE: problem with getting the number of children - Carol - 02-28-2008 Hi Deepak, Thank you so much for your reply. However, still have issue wth this childObjects. Basically , my goal is to find Div within a div. To locate the Div I want to locat, there are multiple layer between. To give you a simply example, it wil be something like : Browser->frame -> table -> Div ->Table -> Div ->Div It is the final Div I want to located. However, to make the story compliated, the structure of the final Div isas such : Code: <div id="designerForm:mde1_Accounts_member_node" class="datatab_node_div"> I have try to insert this code Code: obj_ChkDesc("Class Name").Value = "WebElement" Now my code is as : Code: Dim obj_ChkDesc With this I am getting 0 for my num. If I change Set allNodes= dataPane.ChildObjects() I am getting 10. seems like ChildObjects is getting the leave element, In other words, it is counting at the number of SPAN (Notice that inside my DIV , I have SPAN). This is not what I want. I want the Parent Div. Can you suggest a way to get the DIV. also, to add on it, do I need to list out the exact path of the DIV. ( this can be very long). Will I be able to use descript to tell the characters of the elements want, and using a general path such as: browser(1).page(1).frame(1)? Again, Many thanks to your suggestion. Carol RE: problem with getting the number of children - Ankur - 02-28-2008 ok...simple things first...what does object spy gives you on spying the particular object? RE: problem with getting the number of children - Carol - 02-29-2008 Hi Ankur, The object that I spying on has the following property if considered as a Test Object: className: WebElement class: datatab_node_div html id: designerForm:mde1_@Accounts_hierarchy_node html tag: DIV innertext: Accounts outertext: Accounts if considered as a Run-time object: className: datatab_node_div id: designerForm:mde1_@Accounts_hierarchy_node tagName: DIV For this partcular chunk of code, I need to fnd a collection of object that has class:=datatab_node_div, and html tag := DIV ( this will be the group of collection characters). I don't want to include any attributes contain" Accounts" as this is the caption's of the object and can be changed as my data changed. Here I also attach a screen shot as what is show at shown inside object spy. Thank you for any insight. Carol RE: problem with getting the number of children - deepakmehta82 - 02-29-2008 While selecting the properties of the child object incude classname along with class and html tag.It might help.Otherwise you have to assign run time properties of the object to it. |