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 u Give Procedure to Handle Pop Window & write Code for that

2 Answers   CTS,


Write a script to delete a specific row in a webtable.

2 Answers   Tech Mahindra,


Which functionalities of QTP used in banking project? pls any say answer?

0 Answers  


Hi,EXCEL SHEET AND DATA TABLE . BOTH ARE SAME OR NOT?

3 Answers  


Why do we use text checkpoint as we can make use of the same in the standard check point?

3 Answers   IBM,






How to test whether the navigation i.e. from one page to another is working r not using QTP for web based application

1 Answers  


How u send bugs to dev'lpment team all at once or one by one or waht is the process?

2 Answers   kenexa,


How to invoke Mozilla from QTP thru VB Script

2 Answers  


What is the difference between QTP and WinRunner? Why do you choose only QTP for automation among remaing tools like Rational robot and silk test? Write the VBscript for any functionality in your project ? What is the cost of QTP ? If you entered into yahoo mail with your valid user name then you will get FOR EXAMPLE , " welcome to krishna " on the top of inbo page , how can you test it in QTP? What type of testing you can do, when we gave you 5 screens and how can you test that application? What type of framework you are using in your company and explain it?

0 Answers   CTS,


What is the difference Between LowLevel and Normal Recording Modes?

1 Answers  


What is an object repository?

0 Answers  


what is the difference between function and subroutine ....here every one knows theoretically...here my QUESTION IS WHAT IS THE MEANING OF FUNCTION CAN RETURN A VALUE AND SUB CAN NOT RETURN A VALUE .....WHAT DOE'S IT MEAN FUNCTION CAN RETURN A VALUE HOW FUNCTION CAN AND SUB CAN'T ....GIVE A EXAMPLE FOR BOTH ....HOW IT CAN AND CAN NOT...HELP ANDY ONE....

1 Answers   HCL,


Categories