![]() |
How to capture dynamically changing element ids of a text box? - 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: How to capture dynamically changing element ids of a text box? (/Thread-How-to-capture-dynamically-changing-element-ids-of-a-text-box) |
How to capture dynamically changing element ids of a text box? - pmishra - 06-29-2011 Hi, I am writing scripts for a web page, which has 7 edit boxes. The element id of each box is unique. The element ids are changing dynamically each time you invoke the page. I inspected the properties of the edit boxes using developer tool bar and below are the details: Code: EditBox1 : <input type="text" title="ETC: 6.40" alt="ETC: 6.40" class="formFieldNoWidth" maxlength="" size="4" value="" id="d91519e189" name="actuals_hours"> Code: EditBox1 : <input type="text" title="ETC: 6.40" alt="ETC: 6.40" class="formFieldNoWidth" maxlength="" size="4" value="" id="d96132e187" name="actuals_hours"> Regards, Pinaki RE: How to capture dynamically changing element ids of a text box? - parminderdhiman84 - 06-29-2011 Hi, Did you try using descriptive programming. Regards, Parminder RE: How to capture dynamically changing element ids of a text box? - pmishra - 06-29-2011 Yes I tried. But the class name is same for all the boxes. Only the element ids are changing dynamically. Can you provide any sample code ? RE: How to capture dynamically changing element ids of a text box? - parminderdhiman84 - 06-29-2011 Hi, Please see if this solves your problem: Code: Set oDesc=Description.Create() you can check in which edit box "test1" is entered and similarly you can enter values in all the 7 edit boxes just by changing the item number Regards, Parminder RE: How to capture dynamically changing element ids of a text box? - rajpes - 07-05-2011 Forget about qtp for a while, how will we ourself recognize those edit boxes uniquely when the only property known itself keeps changing? You will have to ensure uniqueness! ask the developers to give unique "name" to the text boxes or find out why the id is changing |