Micro Focus QTP (UFT) Forums
Finding the correct Link - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Finding the correct Link (/Thread-Finding-the-correct-Link)



Finding the correct Link - mv8167 - 01-20-2012

Attached is a set of 4 screenshots each of an Object Spy of a Display link. The only difference I can see to deffer between each link izs the absY and href properties.

How can I use the below to find each Display link?

Code:
Browser("Wisdom").Page("Wisdom").Frame("parent").Link("Display").Click


thx for looking


RE: Finding the correct Link - anil2u - 01-24-2012

Hi,

Try using the WebTable DocumentType and identify them based on their row,column numbers and use the ChildItem property to set the object and click on them.

Or if you are very much sure that the href property values are not going to change use the identification property href and regularize the expression as
^.*ANNUAL\nSUMMARIES\nAND\nYEARLY\nTAX\nFORMS.*
^.*ASSET\nTRANSFER\/401\nNOTIFICATIONS.* so on...

If you find any other alternative let me know too Smile

Thanks




RE: Finding the correct Link - mv8167 - 01-24-2012

This might be a crazy way to find my link, but i got it to work. What I can find is the group namer table html id, and i knows the name of the report name link that i need, so i find the table and then search the links until i find the matching report name link and thus get the ab s_x and _y cordinates to thus click on the link. goofy?

Here is my code:

Code:
'Set Table to current open GroupName
If Browser("Wisdom").Page("Wisdom IA").Frame("Title:=Please Select An Application").WebTable( "html id:=NestedGrid1").Exist(1) Then
Set TableObj = Browser("Wisdom").Page("Wisdom IA").Frame("Title:=Please Select An Application").WebTable("html id:=NestedGrid1")
Else
Reporter.ReportEvent micFail, "Document View table Missing", "The table for Document Type 1 " & " in: " & ReportsLink & " - was NOT found."
ExitTestIteration
End If

BeginTableCount = 1 'Rows number 1 of table being retrived
EndTableCount = 0 'End row count of table being retrived
NewRowCount = TableObj.RowCount 'Start, Row count of reports for each GroupName
EndTableCount = NewRowCount - 1 'End, Row count of reports for each GroupName

'Find Link name
For r = BeginTableCount to EndTableCount
ColCount = TableObj.ColumnCount®
For c = 1 to ColCount
ChildCount = TableObj.ChildItemCount(r, c, "Link")
If ChildCount > 0 Then
For k = 0 to ChildCount - 1
rNumber = rNumber +1
Set LinkObj = TableObj.ChildItem(r, c, "Link", k)
LinkName = LinkObj.GetROProperty("innerText")
If ReportName = LinkName Then
absX = LinkObj.GetROProperty("abs_x")
absY = LinkObj.GetROProperty("abs_y")
End If
Next