06-24-2013, 01:26 PM
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.
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.
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.