class Dill::Select

A select.

Public Instance Methods

get() click to toggle source

@return [String] The text of the selected option.

# File lib/dill/widgets/select.rb, line 25
def get
  selected.text unless selected.nil?
end
selected() click to toggle source
# File lib/dill/widgets/select.rb, line 4
def selected
  root.all(:xpath, ".//option", visible: true).select(&:selected?).first
end
set(option) click to toggle source

Selects the given option.

You may pass in the option text or value.

# File lib/dill/widgets/select.rb, line 37
def set(option)
  widget(:option, option).select
rescue
  begin
    widget(:option_by_value, option).select
  rescue Dill::MissingWidget => e
    raise InvalidOption.new(e.message).
      tap { |x| x.set_backtrace e.backtrace }
  end
end
to_cell() click to toggle source
# File lib/dill/widgets/select.rb, line 53
def to_cell
  get
end
value() click to toggle source

@return [String] The value of the selected option.

# File lib/dill/widgets/select.rb, line 30
def value
  selected.value unless selected.nil?
end