Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding Visual Relation id via script to new object
#2
Not Solved
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-V...rk-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

Set desc1 = Browser("MyBrowser").Page("MyPage").WebElement("Country")
desc1.highlight
desc1.setTOProperty "innertext", "Date of Last Update:"
desc1.highlight


Dim VisualRel, relation
Set VisualRel = VisualRelations.Create

Set relation = VisualRel.Add
relation.RelatedObjectPath = "Browser(""MyBrowser"").Page(""MyPage"").WebElement(""Country"")"
relation.relativeposition = micRelLeft
relation.setargument micRelInline, True
Set relation = Nothing

Set desc2 =  Description.Create
desc2( "innertext").Value = ".*"
desc2("html tag").value= "TD"
desc2("Visual Relations").Value = VisualRel

Browser("title:=.*").Page("title:=.*").WebElement( desc2).highlight

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.
Reply


Messages In This Thread
RE: Adding Visual Relation id via script to new object - by ourhari - 06-24-2013, 01:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question adding two conditions into a while statement lotos 4 5,118 11-10-2017, 04:49 AM
Last Post: lotos
  Uft: Adding a property to all ojects into Repository ProTester 0 1,371 06-09-2017, 12:48 AM
Last Post: ProTester
  adding an object to OR seven 1 2,672 02-17-2014, 02:23 PM
Last Post: basanth27
  How to access webtables without adding into Object Repository ramkumarad 7 9,728 12-30-2013, 07:38 PM
Last Post: Sathiya
  Visual Relations does not work with DP ourhari 5 4,741 06-24-2013, 01:04 PM
Last Post: ourhari

Forum Jump:


Users browsing this thread: 1 Guest(s)