12-13-2008, 04:16 AM
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:
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.
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.