to select random number from select list

P

Pranjal Jain

HI
I am having a list. I want to select a number in random from that list?
which command I can use it for doing this?

For example :

$ie.row:)class =>"bgTableAltColors",:index
=>"4").cell:)class,"padTableRightBorder").select_list:)class,"Formelement").option:)text,"Test
Automation - Scripting").select

here instead of "Test automation -scripting" I want to select a option
in random.
How can i do it ?

Please help.
Thanks in advance.
 
H

Heesob Park

Hi,

Pranjal said:
HI
I am having a list. I want to select a number in random from that list?
which command I can use it for doing this?

For example :

$ie.row:)class =>"bgTableAltColors",:index
=>"4").cell:)class,"padTableRightBorder").select_list:)class,"Formelement").option:)text,"Test
Automation - Scripting").select

here instead of "Test automation -scripting" I want to select a option
in random.
How can i do it ?

Please help.
Thanks in advance.
If a list is given:

list = ["a","b","c"]

You can do it like this:

list.sort_by{rand}.first

Regards,
Park Heesob
 
S

saras

To get a random element from an array

some_array[rand(some_array.size)]

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)  
VIDEO #3 out NOW!http://sensei.zenunit.com/

HI
I am having a list. I want to  select a number in random from that  
list?
which  command I can use it for doing this?
For example :
$ie.row:)class =>"bgTableAltColors",:index
=
"4
").cell
:)class
,"padTableRightBorder
").select_list:)class,"Formelement").option:)text,"Test
Automation - Scripting").select
here instead of "Test automation -scripting" I want to  select a  
option
in random.
How can i do it ?
Please help.
Thanks in advance.

- Show quoted text -

wow you love thouse videos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top