Method: Watir::Element#click
- Defined in:
- lib/watir-webdriver/elements/element.rb
#click(*modifiers) ⇒ Object
Clicks the element, optionally while pressing the given modifier keys. Note that support for holding a modifier key is currently experimental, and may not work at all.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/watir-webdriver/elements/element.rb', line 113 def click(*modifiers) assert_exists assert_enabled element_call do if modifiers.any? assert_has_input_devices_for "click(#{modifiers.join ', '})" action = driver.action modifiers.each { |mod| action.key_down mod } action.click @element modifiers.each { |mod| action.key_up mod } action.perform else @element.click end end browser.after_hooks.run end |