Try .getSelectedItems[0] to get the currently selected option.

Try .getAllContents to get an array of the available options.

This info from
http://groups.google.com/group/watir-general/browse_thread/thread/22400557ce0ef33d/d2b1ff0fe5559bf4?lnk=gst&q=get+value+of+select_list#d2b1ff0fe5559bf4

Once you have an array of options, you should be able to iterate
through them.

Hope it helps.

orde

On Jan 21, 1:11 pm, Shlomit Gazit <shlomitpatr...@gmail.com> wrote:
> Hello Tiffany and Orde,
>
> getSelectedOptions gave me:undefined method `getSelectedOptions' for
> #<Watir::SelectList:0x31482e8> error.
>
> In anyhow:
>
> I am doing:
>
>  status_value = $ie.select_list(:name, "selectedImperativeStatusId").value
>
>  status_next_value = (status_value.to_f + 1).to_s
>
>  *puts*(status_next_value.*class*)
>
>  # 2
>
> * puts*(status_next_value)
>
>  # String
>
> * puts*(status_next_value)
>
>  #3.0
>
>  $ie.select_list(:name, "selectedImperativeStatusId").select_value(
> "status_next_value")
>
> Although status_next_value is showing as a String class, I am getting:
>
> Watir::Exception::NoValueFoundException: No option with value of
> status_next_value in this select element.
>
> Somehow it is showing 3.0 instead of 3.
>
> Any idea?
>
> Basically I need each time to select a different selection from the list,
> than the one that has already been selected.
>
>
>
> On Thu, Jan 21, 2010 at 10:34 AM, Tiffany Fodor <tcfo...@comcast.net> wrote:
> > Hi Shlomit!
>
> > You can get the current selected values like this:
>
> > browser.select_list(:id, 'my_select_list').getSelectedOptions
>
> > This returns an array of all selected options, so if there's only
> > one,
>
> > browser.select_list(:id, 'my_select_list').getSelectedOptions[0]
>
> > will give you the text.
>
> > Hope this helps!
>
> > -Tiffany
>
> > On Jan 21, 11:16 am, Shlomit Gazit <shlomitpatr...@gmail.com> wrote:
> > > How can I find out what has been selected in a dropdown?
> > > I would like to always modify the find value but I should know first
> > > what the value was.
>
> > > Any idea anyone?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Watir General" group.
> > To post to this group, send email to watir-general@googlegroups.com
> > Before posting, please read the following guidelines:
> >http://wiki.openqa.org/display/WTR/Support
> > To unsubscribe from this group, send email to
> > watir-general-unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/watir-general
-- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general

Reply via email to