12-17-2009, 02:31 PM
Hi Swetha,
Yes you can pass the variable as a range for RandomNumber
you have used 'GetTOProperty'. there is no any method as such in QTP a similar method is GetTOProperties return properties and values of an object used to identify the object. you should use GetROProperty to retreive the value of a particular property.
when you use 'select' for a weblist, if you are using the item in the list you can put the item derectly to select but if you use index then you should use "#1","#2" etc.
I have tried to modify your code
let me know if this helps
Yes you can pass the variable as a range for RandomNumber
you have used 'GetTOProperty'. there is no any method as such in QTP a similar method is GetTOProperties return properties and values of an object used to identify the object. you should use GetROProperty to retreive the value of a particular property.
when you use 'select' for a weblist, if you are using the item in the list you can put the item derectly to select but if you use index then you should use "#1","#2" etc.
I have tried to modify your code
Code:
For i = 1 to 3
Mrkt = Browser("TalonPro Solutions").Page("TalonPro Solutions").WebList("Market").GetROProperty("items count")
'trying to get number of items in the Market list.
wait(5)
Browser("TalonPro Solutions").Page("TalonPro Solutions").WebList("Market").Select "#" & RandomNumber(1, Mrkt )
'Selecting a random number for the list Market in the range 1 to Mrkt (variable defined in the earlier set)
wait(5)
loctn = Browser("TalonPro Solutions").Page("TalonPro Solutions").WebList("Location").GetROProperty("items count")
'trying to get number of items in the Location list
wait(7)
Browser("TalonPro Solutions").Page("TalonPro Solutions").WebList("Location").Select "#" & RandomNumber(1,loctn)
'Selecting a random number for the list Market in the range 1 to loctn (variable defined in the earlier set)
Next
let me know if this helps