These are accessed by calling
SelectCollection is accomplished with
For all of the different ways of locating a
take a look at our Locating Elements Guide.
Option elements should generally be accessed via a
Select element instance.
Browser Drivers treat
Option elements differently than other elements.
They are the only element type that does not need to be displayed on the page in order to
click them. That means you do not have to first click the
Select element to use it.
Option elements also inherit methods from standard Web Elements
Common or Special Methods
Select#clear- this only applies if the checklist has a
Standard Setter Interface
This functionality was added in Watir 7 beta 2.
Select#set is an alias of
#select. It takes a number of different argument types:
- When the first parameter value is a
Regexp, Watir will select the first
Optionthat matches by
- When the first parameter is a value is a
Numeric, Watir will convert it to a String and select the first
Optionthat matches by value, text or label.
- When the
:labelkeywords are used, Watir will select the first
Optionthat matches on that particular attribute.
- When an
Arrayor multiple parameters are passed in, Watir treats the
Selectobject as having the attribute
multiple, and will select every
Optionthat matches each value in the