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

Can we record using all the modes in a single script? Explanation with example is appreciated

0 Answers  


Can we run multiple QTP scripts one after the other without manual intervention? How?

0 Answers  


What is RTM (require ment tracebulity marix) fromate?

0 Answers   Wipro,


can anyone answer this question ........in the DICTIONARY OBJECT....i created the dictionary object in reserved object ok....here i have some sets of values ...now i want to retrieve the item i done too ok.......here my question is now i saved the test and close the qtp tool ,again i opened now i retrieve the same item in the dictionary is it possible ????. friends when i try to do this i am getting empty message box i mean no value will be retrieved ......ans me any one plz...

1 Answers   FSS,


How to change the Default synchronization method time and where?

4 Answers  


what is the difference between image and bitmap check point

3 Answers  


what the diffference between test data and test cases what is meant by object hierarchy in qtp

4 Answers   Virtusa,


Explain how you can find the absolute value of the number in qtp?

0 Answers  


More details about keyword driven technique in QTP

1 Answers   TCS,


How can we parameterize our test, values in flat file. Ex:- Values in notepad, with that values i want to parameterize the test.

3 Answers   Ordain Solutions,


Explain synchronization types in QTP

2 Answers  


what do you call the window testdirector-testlab?

1 Answers  


Categories