how can you select random value for every iteration from a
weblist

Answers were Sorted based on User's Feedback



how can you select random value for every iteration from a weblist..

Answer / vijay

Dim ListCount

ListCount =
Browser("Name").Page("Name").WebList("Name").GetROProperty("items
count")'Count the items in the list

ListCount = ListCount-1 'index value starts from 0

Randomize 'initiate random number

RandomValueList = Int(ListCount * Rnd)' convert
listcount as random number in the RandomValueList variable

Browser("Name").Page("Name").WebList("Name").Select
("#" & RandomValueList) 'Call the RandomValueList variable
appending to index of weblist

Is This Answer Correct ?    6 Yes 1 No

how can you select random value for every iteration from a weblist..

Answer / amarendra kothuru

First get the Items count from the List and Use the
RandomNumber() function to get the random Index value. The
below code will work

ItemsCount = Browser("Browsername").Page("PageTile").WebList
("WebListName").GetROProperty("items count")
Browser("Browsername").Page("PageTile").WebList
("WebListName").Select ("#" & RandomNumber(0,ItemsCount))

Is This Answer Correct ?    7 Yes 7 No

how can you select random value for every iteration from a weblist..

Answer / kiran1783

get thetotal items in the list
and use the ' Randamize ' function Rnd()

Is This Answer Correct ?    1 Yes 4 No

how can you select random value for every iteration from a weblist..

Answer / kishore

Get the count of elements in the weblist


for i = 0 to count-1

result = randomnumber(i,count-1)


browser("xyz").page("xyz").weblist(" ") .select result

next

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More QTP Interview Questions

hi gavasker i want how to merg OR's in QTP 8.2 by QTP Plus

1 Answers  


How you automate testscripts one by one or moduelwise or all at once

2 Answers  


How to open a new test using quicktest professional (qtp)?

0 Answers  


Sometimes my QTP scripts works fine and sometimes its not though I am using same shared Repository and am not doing any changes in it.Even though for descriptive programming also its works fine and sometimes it does not work.my application is pretty stable.Could anyone please answer why am facing these types of issue??

1 Answers  


what is smart identification?

1 Answers  






Hi, I want to write the script for a webpage. But i didn't added the properties of the objects to the object repository. Without adding the object properties to the object repository, how to write the script. When i am writing the script, Let us say i typed as Browser (""). after selecting ".", if the object is added to the object repository it will display atomatically. But in my case it is not as i didn't added the object properties. How to proceed further in the above mentioned case to write the script manually. Pls let me know if you didn't understand the question.

3 Answers  


how to compare two excell sheets by using vbscript??

2 Answers  


If an application name is changing frequently i.e while recording it has name “Window1” and then while running its “Windows2” in this case how does QTP handle?

7 Answers   Covansys,


How to Close all browsers in reverse order.

3 Answers   Marlabs,


How can I find out whether a word in a string is existed or not for example "QTP IS A POWERFULL TOOL FOR AUTOMATION" How can i find out whether "powerfull" is existed in the above string or not Could anyone answer it?

7 Answers   Livetek,


WHO TAKE DECISION TO RELEASE THE BUILD

2 Answers   IGT,


What is the Difference between copy to action and call to action?

0 Answers  


Categories