Module: Actions
- Included in:
- HTMLGeneric
- Defined in:
- lib/html_action_modules.rb
Instance Method Summary collapse
- #click ⇒ Object
- #fire_event ⇒ Object
- #set_multiple_options ⇒ Object
- #set_text ⇒ Object
- #set_text_value ⇒ Object
- #simulate_key_press ⇒ Object
- #submit_form ⇒ Object
Instance Method Details
#click ⇒ Object
4 5 6 7 8 |
# File 'lib/html_action_modules.rb', line 4 def click execute(this_method){ @element.click } end |
#fire_event ⇒ Object
16 17 18 19 20 |
# File 'lib/html_action_modules.rb', line 16 def fire_event execute(this_method){ @element.fireEvent @value } end |
#set_multiple_options ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/html_action_modules.rb', line 61 def execute(this_method){ if @element.getAttribute('multiple') = [] @element..each{|option| option.selected = @value.include? option.innerHTML << option.innerHTML } @value.each{|value| if not .include? value raise ValueNotFound, "Multiple select option not found with #{value}" end } end } end |
#set_text ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/html_action_modules.rb', line 38 def set_text execute(this_method){ #TODO -- raise error here if @value (supplied value) is greater than @element.maxLength #TODO -- raise error if the element is disabled or read only #TODO -- report warning message if element is not visible begin max_length = @element.maxLength rescue max_length = false end @element.value = '' @value.scan(/./).each do |character| if max_length enter_text character unless @element.value.length + 1 > max_length else enter_text character end end } end |
#set_text_value ⇒ Object
32 33 34 35 36 |
# File 'lib/html_action_modules.rb', line 32 def set_text_value execute(this_method){ @element.value = @value } end |
#simulate_key_press ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/html_action_modules.rb', line 22 def simulate_key_press execute(this_method){ @event.keyCode = @value.to_i @element.focus @element.fireEvent('onKeyDown',@event) @element.fireEvent('onKeyPress',@event) @element.fireEvent('onKeyUp',@event) } end |
#submit_form ⇒ Object
10 11 12 13 14 |
# File 'lib/html_action_modules.rb', line 10 def submit_form execute(this_method){ @element.submit } end |