Micro Focus QTP (UFT) Forums

Full Version: How to click on Link having * in the Text
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
What is the error you get?
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
Instead of using CLICK try to use NAVIGATE
Browser("XYZ").Navigate("Link in the data table")

Try this.