Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
recording random link part
#1
Not Solved Question 
Hi, i am using QTP 9.0, in web application i want to test link.
When entering

Code:
Browser("browsername").Page("browserpage").Link("KP (1)").Click RandomNumber(0, 100)

i get the link - KP with random number in brackets [for example "KP (219)", "KP (11)"].
But in my case link is also "KP" [without brackets]. And i can not get the right statement for that the link - "KP (1)" "KP(random number)" and also in case "KP" the link CLICKS Sad[/code]
Reply
#2
Not Solved
It's not clear from your message exactly what you are trying to do, but if I understand you have a page that contains 101 links that all have the format:

KP(n)

Where n is a number from 0 to 100. You are then trying to randomly select and click on one of those links. If this is an accurate description of your issue then you can solve it with some Descriptive Programming:

Code:
Browser("browsername").Page("browserpage").Link("text:=KP(" & RandomNumber(0, 100) & ")").Click

This basically tells QTP to identify a link object with the text value of KP(n), with n being a random number from 0 to 100 and click that link. If there is any other text in the link then this will likely fail. Additionally if there are not 101 links on the page then you run the risk of looking for a link object that does not exist.

Plese respond with a more clear description of the issue if this explanation is insufficient.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Part of parameters missing when passing between actions skumar007 1 2,990 10-10-2014, 02:00 AM
Last Post: skumar007
  Create a random number starting with an alphabet QTPmate 4 4,162 07-31-2014, 09:29 AM
Last Post: QTPmate
  Random Values from Drop-Down profqa 5 6,010 12-06-2013, 09:01 AM
Last Post: basanth27
  Creating Random String SomeIntern 0 5,074 08-21-2013, 09:10 PM
Last Post: SomeIntern
  Random Number generator and verification problem jinnah 4 10,404 09-28-2012, 04:03 AM
Last Post: jinnah

Forum Jump:


Users browsing this thread: 1 Guest(s)