Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are many different ruby-tastic ways to collect information to an array (like collect, etc), here's one:</p> <pre><code>@myArray = Array.new @browser.select_list(:how, what).options.each do |option| @myArray &lt;&lt; option end </code></pre> <p>Since "options" gives you all of the options in Array format, you can also (and probably should) just do:</p> <pre><code>@myArray = @browser.select_list.options </code></pre> <p>Update based on your comment - that code generated the list you were looking for, but you did not specify what you're looking to do with it. The output you see is the Ruby Object format of the list. In the same way we iterated over the items above, you can iterate through your array options:</p> <pre><code>@num = 0 @myArray.each do |option| @num += 1 puts "#{@num}. option" end </code></pre> <ul> <li>Output would look like: <ol> <li>Baseball</li> <li>Basketball</li> <li>Underwater basketweaving</li> </ol></li> </ul> <p>You can write them to a file, the console, save them, etc. Those are straightforward Ruby things to do. Hope that helps!</p> <p>Update #2 based on your comment: I believe that you need to simplify how you're thinking about the application. We're no longer talking about missionaries or basketballs or even a webpage. Since we have identified the object you needed to access (the select_list), and pulled its data into an Array, we can now perform actions on it.</p> <p>We have an Array. We know that this Array contains all of the individual options from a select_list. We can use any Ruby Array methods then to do <em>something</em> to this data. If we want the total number of options:</p> <pre><code>@myArray.length (basically, @browser.select_list.options.length) </code></pre> <p>Likewise, you can delete_at with this Array, you can re-order its contents, or you can display each item as I did in Update #1.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload