class Watir::Option

Represents an option in a select list.

Public Instance Methods

clear() click to toggle source

Clears (i.e. toggles selected state) option.

@example

browser.select(id: "foo").options.first.clear
# File lib/watir/elements/option.rb, line 32
def clear
  click if selected?
end
selected?() click to toggle source

Is this option selected?

@return [Boolean]

# File lib/watir/elements/option.rb, line 42
def selected?
  element_call { @element.selected? }
end
text() click to toggle source

Returns the text of option.

getAttribute atom pulls the text value if the label does not exist

@return [String]

# File lib/watir/elements/option.rb, line 54
def text
  attribute_value(:label)
end