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

what is exit and entry criteria of automation testing. any body wants a real time script,please mail to me. contactno;9986435766

2 Answers  


Hi,All How to create a link in excel sheet using qtp

0 Answers  


can we call a test in another test? how? explain with one example?

1 Answers   iFocus,


Hi, Can anyone write the following qtp script...please its urgent ·Navigate to Google in a new IE instance ·Search for the following word "Gap, Inc." ·Iterate thought the first 10 pages of google ·On each page collect the following ·The "blue" page title ·The "green" url ·Output all the data into a file named "test_output.txt" ·Format "Title – URL"

1 Answers  


How to write test cases for web applications using QTP.plz write a sample test case to show how to write.urgently needed.thanks in advance..

4 Answers   IBM,






How to use library files in QTP? how we can call these files in to script?

4 Answers   Virtusa, Wipro,


how do u plan test automation?

0 Answers  


What are the QTP advantages and disadvantages?

6 Answers  


how do check the links in a webpage ?

7 Answers   Accenture, Wipro,


what is the difference between xmlutil and xmlDOM in qtp?

2 Answers  


How do u do batch testing in WR & is it possible to do in QTP, if so explain?

1 Answers   Crea,


Functions call by reference and call by value. i want the diff b/n these 2 and how will be the script for this?in which situation we use these 2..?pls explain me clearly

0 Answers  


Categories