Unable to Create and/or Use Visual Relations in Test
I am trying to write a test in UFT 12.02. I am not a tester or a developer. This is a proof-of-concept. And if you put two-and-two together there, yes my company pays for a software license for software they do not use.
I have a table with 4 columns, each row contains details about a report. In the left-hand column is a TEXT link to edit the report; in the right-hand column is an IMAGE link to view the report. So if the table has twenty links with unique text, it also has twenty links that all use the same image. For a given report, I need to find the unique text link on the left and then follow the corresponding image link on the right.
I have used the Object Repository to link the image to the text, and when I preview the relationship it appears to be set up correctly. But I haven’t been able to find out how I am supposed to use this definition to help write a test.
Instead I have been trying to follow examples online to establish this link programmatically. It is not working, and I am running out of ideas/resources. My task is to write a UFT test that finds the unique left-hand text (in a “Report ID” WebElement) and follows the corresponding right-hand image (“View Report”). But my current test is spitting out information to try to help me debug the problem rather than click the link. I create a set of objects based on the Description Object, but no items are returned, if I remove the line “oDesc("visual relations").Value = rc” then I get one item, the WebElement I am looking for. However if I remove the other three lines setting Values, I find lots of objects. I cannot seem to establish the link between the Report ID element I want and the image to the right of it. Any help is appreciated. Here is the current iteration of my test:
varReportID = "5704"
Set rc = VisualRelations.Create
Set relation = rc.Add
relation.relatedobjectpath = "Browser(""name:=Browser"").Page(""name:=Dashb oard "").Image(""name:=View Report"")"
relation.relativeposition = micRelRight
relation.setargument micrelinline, True
Could you just get the childObject from the table?
1. You can GetRowWithCellText to find the row (you said that column one contains unique text),
2. You know that the image link is in 4th column, and you know the object class.
3. so getChildObjects(...) should be a pretty simple way to click the 'view report' image.