Micro Focus QTP (UFT) Forums

Full Version: How to handle the dynamic links based on search results…?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have the following steps in my application…

a) go to login page ,give user id and pwd ‘successfully able to login
b) 2nd page is search page … enter the search item and click on submit then
based on the search item the display Link in the same page varies
now if I click on this link will take to corresponding page.

If my search word is housing it will display as ..
Code:
Browser("XYZ: Login").Page("abcPage").Link("Housing and construction").Click
If my search key is real estate then it will display as
Code:
Browser("XYZ: Login").Page("abcPage").Link("Real Estate").Click
How to parameterize the the link name eg:- Housing and construction/Real Estate in the above statement

I tried using below…
Code:
Str = “Housing and construction”
Browser("XYZ: Login").Page("abcPage").Link(""&Str).Click
Did gave me an error when I change Str=”Real Estate” saying not able to recognize the object


Please can anyone have some solutions how to handle this problem
need it very urgent

Thanks
Navya
You can use descriptive programming.
Ankur has as excellent post in this site. Check it out.
Hello niranjan,

I went thru that stuff before posting the query
bit confusing to me and i tried various scenarios from what i understood and couldn't get along .

scenarios which i tried are...( some thing i am missing in the below ones)
scenario 1:-
-----------
Code:
str = Inputbox "enter string for search"
Set lnkSearch = Description.Create. btnSearch(”name“).Value = ""&str
Set brwlink = Description.Create : brwGoogle(”title“).value = "XYZ: Login"
Set pglink = Description.Create : pgGoogle(”title“).value = "abcPage"
Browser(brwlink ).Page(pglink).Link(lnkSearch).Click

scenario2:-
-----------
Code:
str = Inputbox "enter string for search"

Dim obj_desc
Set obj_desc = description.Create
obj_desc("html tag").value= “INPUT”
obj_desc(“name”).value= ""&str


i would be thankful if you can explain me considering my scenario..
the scenario

Thanks
Navya
Hi Navya,
Can you try with this? :

Code:
str = “Housing and construction”
Browser("XYZ: Login").Page("abcPage").Link("name:="&str).Click

Note: if the QTP still doesn't recognize the link, you can use the "Object Spy" in QTP to get more unique properties to identify the link.

Hope it work Smile