Visual Relations does not work with DP - 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: Visual Relations does not work with DP (/Thread-Visual-Relations-does-not-work-with-DP) |
Visual Relations does not work with DP - ourhari - 06-23-2013 Hi experts, I'm new to QTP DP and I'm having issues in object identification using Visual Relations. However the same is working fine with establishing relationship in OR. Please see the attached image. There is a "Date of Last Update:" label, followed by a date as label. These two labels are available in TD elements of a HTML table. With the below code, I'm expecting to locate the actual date value in the page (i.e., extract last update date from the page for further processing). However, I'm getting the below code. ==================== ERROR MESSAGE ================ Cannot identify the object "[ WebElement ]" (of class WebElement). Verify that this object's properties match an object currently displayed in your application. Line (41): "Browser("title:=.*").Page("title:=.*").WebElement( desc2).highlight". Tip: If the objects in your application have changed, the Maintenance Run Mode can help you identify and update your steps and/or the objects in your repository. ================================================= Line 41 is the last line in the below code snippet. Until this line, I'm getting the results as expected; i.e., the table cells are properly highlighted. Code: Dim desc1, desc2, desc3 Even if I have removed the "relation1", I'm still getting the same error. I have also tried to provide the below to the RelatedObjectPath property of relation & relation1 objects. Existing: Code: relation.RelatedObjectPath = "Browser(""title:=.*"").Page(""title:=.*"").WebElement(desc1)" Code: relation.RelatedObjectPath = "Browser(""title:=.*"").Page(""title:=.*"").WebElement(""innertext:=Date of Last Update:"", ""html tag:=TD"")" ... but still I'm getting the same error. Could any one please review and let me know what mistake I made that prevented me getting the expected behaviour? As a side node: Is this the right approach to extract data using DP? Or are there any other methods that can be used? Many thanks in advance. Regards, Hari RE: Visual Relations does not work with DP - Ankur - 06-23-2013 Hari, Welcome to QTP forums. Why are you using Visual Relation identifiers? Did you try the normal approach first by Object spying on the date? RE: Visual Relations does not work with DP - ourhari - 06-24-2013 (06-23-2013, 09:10 PM)Ankur Wrote: Hari, Welcome to QTP forums. Please find below the identification properties taken from Object Spy. "Class Name:=WebElement", "abs_x:=449", "abs_y:=758", "class:=", "height:=16", "html id:=", "html tag:=TD", "innerhtml:=14-May-2013 ", "innertext:=14-May-2013 ", "outerhtml:=<TD vAlign=top align=left>14-May-2013 </TD>", "outertext:=14-May-2013 ", "type:=", "visible:=True", "width:=510", "x:=346", "y:=538" I have written the below code to identify the object and it is successful. Code: Set desc2 = Description.Create However, the page contains many such date values and I want to identify only the date value after 'Date of Last Update:' text. Please review and advise. RE: Visual Relations does not work with DP - Ankur - 06-24-2013 Okay even in case of multiple dates being on the same page here is what I can advise -
RE: Visual Relations does not work with DP - ourhari - 06-24-2013 @Ankur, Thanks for the alternate solution. I understand that it will definitely work in a static page; where there are fixed number of such date text values. However, I would like to understand what is wrong with the Visual Relations and why it did not work. I guess that I made some trivial mistake, but do not know how to spot it. Any help would be greatly appreciated. Thanks again. RE: Visual Relations does not work with DP - ourhari - 06-24-2013 On searching the net for solutions, I came across a post (www.knowledgeinbox.com), where I confirmed with @Tarun that Visual Relations work with OR objects only. http://knowledgeinbox.com/forums/uft-qtp-bpt-st/dp-in-the-visual-relation-identifer/ I created an OR object and used it in the Visual Relations as given below and it is identifying the object as expected. Code: relation.RelatedObjectPath = "Browser(""MyBrowser"").Page(""MyPage"").WebElement(""LastUpdatedDateLabel"")" Therefore, it has to be a blend of OR and DP when it comes to Visual Relations. |