Class: Watir::Container::SelectList

Inherits:
InputElement show all
Defined in:
lib/safariwatir.rb

Constant Summary

Constants inherited from HtmlElement

HtmlElement::OPERATIONS

Instance Attribute Summary

Attributes inherited from HtmlElement

#how, #what

Instance Method Summary collapse

Methods inherited from InputElement

#by_value, #enabled?

Methods included from Clickable

#click

Methods inherited from HtmlElement

#exists?, #name, #operate

Instance Method Details

#option(how, what) ⇒ Object



253
254
255
# File 'lib/safariwatir.rb', line 253

def option(how, what)
  Option.new(@scripter, self, how, what)
end

#select(label) ⇒ Object



245
246
247
# File 'lib/safariwatir.rb', line 245

def select(label)
  option(:text, label).select
end

#select_value(value) ⇒ Object



249
250
251
# File 'lib/safariwatir.rb', line 249

def select_value(value)
  option(:value, value).select
end

#selected_valueObject



269
270
271
# File 'lib/safariwatir.rb', line 269

def selected_value
  selected_values.first
end

#selected_valuesObject



257
258
259
260
261
262
263
264
265
266
267
# File 'lib/safariwatir.rb', line 257

def selected_values
  values = []
  index = 1
  loop do
    option = option(:index, index)
    break unless option.exists?
    values << option if option.selected?
    index += 1
  end
  values.map {|o| o.text } #TODO?
end

#speakObject



273
274
275
# File 'lib/safariwatir.rb', line 273

def speak
  @scripter.speak_options_for(self)
end

#tagObject



277
# File 'lib/safariwatir.rb', line 277

def tag; "SELECT"; end