![]() |
Dynamic Object or Virtual Object - 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: Dynamic Object or Virtual Object (/Thread-Dynamic-Object-or-Virtual-Object) |
Dynamic Object or Virtual Object - Suba - 04-08-2011 Hi, I am farely new with QTP and self learning. I have a situation and not sure how to deal with the Dynamic number of objects. I have a Weblist Object. Depending on the item I SELECT from the Weblist Object a variable list of rows will be displayed on the screen which composes of the following. WebCheck Box Object, Text Description and WebEdit Object. Where: Text Description represents Product Description and WebEdit Object represents Quantity for the product. The products can be selected by Clicking the Check Box and entering it's corresponding Quantity in the Edit Box. After the final selection and inputing the required values a Confirmation button is clicked which would display the final list of selected products with their quantity. Not sure how to standardize this dynamic selection. Not sure if Virtual Object can be used since the the requirement is beyond Clicks and DblClicks as Values are required to be entered for the selected items. Please help with your suggestions. Thanks, Subha RE: Dynamic Object or Virtual Object - basanth27 - 04-08-2011 Subha - I think you need to read the object properties and then find the common values of the property, regular expression it and then use a combination of descriptive programming if necessary and then perform your operation. Virtual objects are out of context in the above case as you seem to mention that the objects are being identified by QTP. Makes sense? RE: Dynamic Object or Virtual Object - Suba - 04-08-2011 Just to make sure, I am sending the scripts fron the Expert View based on 2 Items selected from a list of 8. This list can vary. The recorded objects are the Check Box clicked and it's corresponding value entered in the Webedit object. I am also attaching the properties for both the set of check boxes and their Webedit object having their values captured. Please advise me how do I programatically Check to select and assign Value dynamycally? Do I use the Identifier value within each object property to identify and select? Thanks, Subha DETAILS As Below: Code: Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise_2").WebCheckBox("WebCheckBox_2").Set "ON" RE: Dynamic Object or Virtual Object - basanth27 - 04-08-2011 Intresting. Well, its not on a webtable but on a page. The objects have been identified by their index. Well here is what i was trying to explain, 1. It is clear from you explanation that when a checkbox is selected the edit is enabled and then you will need to put in the value. The issue is the variations and the checkbox and edit being displayed at varying numbers. 2. I would suggest that you spy on the webcheckbox and the webedit and find out which is the common property among the various appearing ones. Then you could do a raw descriptive program as such, Code: Eg: Honestly, i am not very sure about the whole solution which i am offering. Although you have taken great pain to write up so much of a detailed explanation i feel ashamed to not have been able to decipher and imagine the application and suggest you a right forward solution. Please attempt and let me know if you have been able to proceed any further. RE: Dynamic Object or Virtual Object - Suba - 04-09-2011 Thanks Basanth. I will try as you have suggested. In the meantime I have encountered the following error while I was exploring the ChildObject path. The corresponding code is also below where the error is occurring. Could please point my mistake. Thanks, Subha Code: Start Of Child Test RE: Dynamic Object or Virtual Object - Nilesh - 04-11-2011 Hi subha, you have forgot to use SET keyword. MOdify your code as below. SET td_obj=Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter RE: Dynamic Object or Virtual Object - Suba - 04-19-2011 Thanks for the help. That worked ![]() However, I was trying to identify the dynamic Child checkboxes, but made no progress. I believe if I am able to figure out with the checkboxes, similar process would apply for the dynamic child webedit too. This is what I have tried with 2 different approach. I have attached snapshot from the ObjectSpy for the 1st checkbox and the Editbox. The 1st approach returned results but they where all "TABLE" for 'html tag' and blank for 'html id' as per snapshot of the ouput in the attached document. The 2nd Approch produced not result as the count was 0 (ZERO). Both the codes are as below. Need your help and input. Thanks, Subha First Try: Code: Set obj=Description.Create Second Try: Code: Set obj=Description.Create RE: Dynamic Object or Virtual Object - Suba - 04-19-2011 Not sure if this is the right way to identify the dynamic Child Objects / Objects. This is was my last try. Need some help and direction. I was trying to identify the dynamic Child checkboxes, but made no progress. I believe if I am able to figure out with the checkboxes, similar process would apply for the dynamic child webedit too. This is what I have tried with 2 different approach. I have attached snapshot from the ObjectSpy for the 1st checkbox and the Editbox. The 1st approach returned results but they where all "TABLE" for 'html tag' and blank for 'html id' as per snapshot of the ouput in the attached document. The 2nd Approch produced not result as the count was 0 (ZERO). Both the codes are as below. Please correct me where I went wrong. Thanks, Subha First Try: Code: Set obj=Description.Create Second Try: Code: Set obj=Description.Create RE: Dynamic Object or Virtual Object - vIns - 04-27-2011 Hi, Can u update ur second approach as given below and try. Code: obj("class").value="WebCheckBox" change this to obj("micclass").value="WebCheckBox" We do not use 'class' or 'Class Name' to check the Object Type in DP. We need to use micclass. |