Another option:

array[rand(array.size)]

On Thu, Sep 30, 2010 at 10:25 AM, Željko Filipin <
[email protected]> wrote:

> On Thu, Sep 30, 2010 at 3:15 PM, ISmellGas <[email protected]>
> wrote:
> > Is it possible to get the contents of the select list into an array,
> > count how many items are in that array and select a random one?
>
> Sure, select_list.options will return array of contents, then just pick a
> random one:
>
> Select lists: http://wiki.openqa.org/display/WTR/Selection+Boxes
>
> Watir API: http://wtr.rubyforge.org/rdoc/1.6.5/
>
> For random numbers:
>
> http://www.google.com/search?q=ruby+random
>
> http://www.codeodor.com/indein:trashx.cfm/2007/3/25/Ruby-random-numbers/1042<http://www.codeodor.com/index.cfm/2007/3/25/Ruby-random-numbers/1042>
>
> Let us know if you get stuck.
>
> Željko
> --
> watir.com - community manager
> watirpodcast.com - host
> testingpodcast.com - audio podcasts on software testing. all of them
>
>
>  --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]<watir-general%[email protected]>
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to