Micro Focus QTP (UFT) Forums
How to click on Link having * in the Text - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to click on Link having * in the Text (/Thread-How-to-click-on-Link-having-in-the-Text)



How to click on Link having * in the Text - neel72 - 03-25-2011

I have to write code to click on Link which contains "*" at end of text, example - TestLink *
I have populated these link names in the Datatable. Now to click on the link, I have the following code

'*** get link name
Code:
strLinkName = datatable.value("Global","LinkName")

'**** check the link Exist
Code:
If Browser("XYZ").Page("XYZ").Link("text:=" & strLinkName, "html tag:=A").Exist Then
Browser("XYZ").Page("XYZ").Link("text:=" & strLinkName, "html tag:=A").Click
Else
msgbox "Link Not Found"
End if

This code works fine for strLinkName= Test Link ,but fails when name has "*" at the end , like strLinkName= Test Link *

Please suggest where I missed something, I have few links in my test app, which needs to clicked to perform next function.
Thanks
Neel


RE: How to click on Link having * in the Text - basanth27 - 03-25-2011

What is the error you get?


RE: How to click on Link having * in the Text - neel72 - 03-25-2011

I tried to debug, it doesn't recognize the Link Name with the "*" and skips to the Else statement. and then Comes out of the Test run. I thought to add all the links in OR and then in the innertext property have the Test Link * replaced by RegEx Test Link \*, this works while using it with Object Spy.

let me know, another approach to acheive this.
Thanks
Neel


RE: How to click on Link having * in the Text - Rohan - 05-03-2011

Instead of using CLICK try to use NAVIGATE
Browser("XYZ").Navigate("Link in the data table")

Try this.