Module: HumaneWebDriverExtensions

Included in:
Selenium::WebDriver::Element
Defined in:
lib/webdriver-extensions.rb

Instance Method Summary collapse

Instance Method Details

#value=(new_value) ⇒ Object

deal with different html element types:

boolean for checkboxes, radio buttons, and individual options in select controls
string for inputs, textarea, and selects
send JavaScript for hidden inputs?


8
9
10
11
12
13
14
15
16
# File 'lib/webdriver-extensions.rb', line 8

def value=(new_value)
  case self.tag_name.to_sym
    when :input, :textarea
      clear
      send_keys new_value.to_s
    else
      raise "cannot set value for a #{self.tag_name} element - only input and textarea supported"
  end
end