Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding Visual Relation id via script to new object
#1
Not Solved
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
Dim oDesc        'Description Object
Dim colObject    'Object Collection
sEmail="john214@smith.com"

Set oDesc = Description.Create
oDesc( "micclass" ).value = "WEBELEMENT"
'Additional property- for more focused and controlled collection
oDesc( "Innertext" ).value = sEmail

Set colObject = Browser("title:=MYTITLE").Page("title:=MYTITLE").ChildObjects(oDesc )


Dim oVisualRelation, oRelationToElement, oElementDesc,colobject2
Set oVisualRelation = VisualRelations.Create
Set oRelationToElement = oVisualRelation.Add
oRelationToElement.relatedobjectpath = "Browser(""title:=MYTITLE"").Page(""title:=MYTITLE"").ChildObjects(oDesc )"
oRelationToElement.relativeposition = micRelLeft
oRelationToElement.setargument micRelInline, True

Set ElementDesc = Description.Create
ElementDesc("micclass").Value = "WEBELEMENT"
ElementDesc("visual relations").Value = VisualRelation
Set colobject2 = Browser("title:=MYTITLE").Page("title:=MYTITLE").ChildObjects(ElementDesc)

colobject2(0).Highlight

------------------------------------------------------------------------

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


Messages In This Thread
Adding Visual Relation id via script to new object - by jcraig26 - 11-03-2012, 12:54 AM

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

Forum Jump:


Users browsing this thread: 1 Guest(s)