Micro Focus QTP (UFT) Forums
How to handle the dynamic links based on search results…? - 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 handle the dynamic links based on search results…? (/Thread-How-to-handle-the-dynamic-links-based-on-search-results%E2%80%A6)



How to handle the dynamic links based on search results…? - navyasatish - 07-23-2008

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


RE: How to handle the dynamic links based on search results…? - niranjan - 07-23-2008

You can use descriptive programming.
Ankur has as excellent post in this site. Check it out.


RE: How to handle the dynamic links based on search results…? - navyasatish - 07-24-2008

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


RE: How to handle the dynamic links based on search results…? - ngocvo3103 - 11-15-2010

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