Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get Link name before clicking it
#1
Not Solved
Hi'

I am trying to read the name of a link before I can click it. When I hover mouse over it it gets highlighted but I cannot get its name till I click it.

So could someone please tell me how to read the name of a link without clicking it.

Thanks,
Sqadri
Reply
#2
Not Solved
Hi,
If u have more than one link in your page u can go for Descriptive Programing.
Code:
Dim obj
Dim obj_link
Dim link_name
Set obj=Discription.Create
obj("html tag").value=XX (use spy to get the value of XX)
obj("micClass").value="Link"
Set obj_Link=Browser(aa).Page(bb).link(obj)
Foreach a in obj_Link
link_name=a.GetRoProperty("name")
Next

Regards,
Sankalp
Reply
#3
Not Solved
Hi SanKalp,

Thank you for your response. I was using your approach and thought there might be better way of doing it. When I enter a search string (eg 111) then I get all the links that have 111 in them so here is how I did it now. Please let me know if there is a better way of douing it. Also could you please tell me how to read static text inside a web page?

Code:
For i =0 To linkCount -1
        linkTag = link_col(i).GetROProperty("name")
        Reporter.ReportEvent micPass, "Link Name", linkTag
        'if  group number '111' exists in the group No link then exit
        If Instr(linkTag, "111") Then
            Reporter.ReportEvent micPass, "Found Group NO", linkTag
            Exit Function
        End If
            
    Next
Thank you,
Sqadri
Reply
#4
Not Solved
Hi Sqadri,

yes it is a good approach, u can use it and for getting the static text can you let us know from where do u want to get the text,i think you want to get the text from a web element?

Regards,
Sankalp
Reply
#5
Not Solved
Sankalp,

It is a link. I have another realated issue. I have the web application version and date that is greyed out and the Version changes. How do I read this version number. I was thinking of using Text checkpoint but when the version changes it will fail. So could you please help me with this issue. The version is WebElement

Thanks,
Sqadri
Reply
#6
Not Solved
Hi,

JUst use spy to identify the object and look for the property like innertext or text and just get that value using GetRoPRoperty.
Hope this will help u.

Regards,
Sankalp
Reply
#7
Not Solved
Hi Sankalp

I used Output Checkpoint, is that a good way to read the greyed out version?

Thanks,
Sqadri
Reply
#8
Not Solved
Hi,
If u want to check that text displayed under greyed out area is correct or not then it is good to use checkpoint but if use want to fetch that data to be used under your script then try to avoid checkpoint, use the GetRoPropert to fetch the data.

Regards,
Sankalp
Reply
#9
Not Solved
Thanks,

I am using thsi code to find a link but when I want to click on this link it does not recognise it. Could you please see if there is anything wrong. aLSO WHENEVER i CLICK INSIDE A PAGE THE NUMBER KEEPS INCREASING LIKE Page(xxx_50) and next time it will be Page(xxx_51), is there a way to avoid this

Thanks,
Sqadri
Code:
Set Des_Obj = Description.Create
Des_Obj("micclass").Value = "Link"
'set parent and child objects
Set link_col = Browser("Horizon Blue Cross Blue").Page("Horizon – Plan Configurator_5").ChildObjects(Des_Obj)    
linkCount= link_col.count
For i =0 To linkCount -1
      linkTag = link_col(i).GetROProperty("name")
      Reporter.ReportEvent micPass, "Link Name", linkTag
      'if  group number '111' exists in the group No link then exit
                
       If Instr(linkTag, groupNo) Then
    Reporter.ReportEvent micPass, "Found Group NO", linkTag
             FAILS ON THE FOLLOWING LINE
             Browser("xxx").Page("xxx_50").Link(linkTag).Click
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Winbutton slow in clicking kpat 0 1,807 05-23-2016, 12:09 PM
Last Post: kpat
  Clicking on sublink venkatesh9032 1 2,778 06-01-2015, 08:26 PM
Last Post: babu123
Exclamation Login & logout in Siebel and clicking pop-up button yuetling926 7 11,365 07-09-2014, 10:43 PM
Last Post: hhamilton
  Clicking a link in an outlook email using QTP kirti 0 5,623 06-15-2014, 01:25 AM
Last Post: kirti
  QTP not clicking on Yes button in the IE pop up dialog adityasrinivasb 2 9,630 09-29-2013, 11:01 PM
Last Post: prashantrawat101@gmail.com

Forum Jump:


Users browsing this thread: 1 Guest(s)