Adding Visual Relation id via script to new 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Adding Visual Relation id via script to new object (/Thread-Adding-Visual-Relation-id-via-script-to-new-object) |
Adding Visual Relation id via script to new object - jcraig26 - 11-03-2012 Here is the scenario. I am using a random number to create an email. It will be in a list with a '+' next to it in a grid. All rows will have the '+' and then the email address in line to the right. I need to expand down the '+' to verify that an email was sent to the email address with the random number. Not only do I not know the email address because of the random number, it can be anywhere in the list - first, last, or anything in between. This means I can't rely on index. My plan - Both of these items are WEBELEMENTS. I want to create the '+' WEBELEMENT and use the email as a Visual Relation identifier in the script. I can create the object for the email no problem. I am having problems getting the visual relation added to the '+'. I may have been looking at this too long as well so sorry if it is a minor mistake I am overlooking. I need to remember to blink! :-) Here the script - I set the email for testing: Code: Dim sEmail ------------------------------------------------------------------------ Sorry if this is a little simple for this forum. I am stuck and relatively new to QTP. Thanks in advance! Okay, according to QTP's help files, you can't do this. You must have the object in the object repository to use it as a visual relation identifier. New plan. Use existing object - add the WEBELEMENT for the email, but update the innertext value. This would make the object on the correct row. Now, how do I update the object values via the script... back to research. But, any suggestions, please let me know. Thanks! RE: Adding Visual Relation id via script to new object - ourhari - 06-24-2013 Disclaimer: I understand this is a old thread, but thought that I can post a code snippet so that it can be referred. In continuation with my another thread (https://www.learnqtp.com/forums/Thread-Visual-Relations-does-not-work-with-DP), I tried to implement the above "new plan", which worked perfect for me. I have used "setTOProperty" to set the property. Here is the code. Code: Dim desc1, desc2 NOTE: Care must be taken, as for the rest of the QTP execution session, "Country" object still refers to the "Date of Last Update:" label only. However, after the execution, the local repository is intact, and points to the Country label only. |