Module: Selenium::WebDriver::KeyActions
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | rb/lib/selenium/webdriver/common/interactions/key_actions.rb |
Instance Method Summary
-
#key_down(key, device: nil) ⇒ ActionBuilder
Performs a key press.
-
#key_up(key, device: nil) ⇒ ActionBuilder
Performs a key release.
-
#send_keys(keys, device: nil) ⇒ ActionBuilder
Sends keys to the active element.
- #key_input(name = nil) private
- #key_down(key, action: nil, device: nil) ⇒ ActionBuilder private Internal use only Internal use only
Instance Method Details
#key_down(key, action: nil, device: nil) ⇒ ActionBuilder (private)
#key_down(element, key, action: nil, device: nil) ⇒ ActionBuilder
This method is for internal use only.
#key_down(key, device: nil) ⇒ ActionBuilder
#key_down(element, key, device: nil) ⇒ ActionBuilder
Performs a key press. Does not release the key - subsequent interactions may assume it’s kept pressed. Note that the key is never released implicitly - either ActionBuilder#key_up
(key) or ActionBuilder#release_actions must be called to release the key.
# File 'rb/lib/selenium/webdriver/common/interactions/key_actions.rb', line 47
def key_down(*args, device: nil) key_action(*args, action: :create_key_down, device: device) end
#key_input(name = nil) (private)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/interactions/key_actions.rb', line 144
def key_input(name = nil) device(name: name, type: Interactions::KEY) || add_key_input('keyboard') end
#key_up(key, device: nil) ⇒ ActionBuilder
#key_up(element, key, device: nil) ⇒ ActionBuilder
Performs a key release. Releasing a non-depressed key will yield undefined behaviour.
# File 'rb/lib/selenium/webdriver/common/interactions/key_actions.rb', line 74
def key_up(*args, device: nil) key_action(*args, action: :create_key_up, device: device) end
#send_keys(keys, device: nil) ⇒ ActionBuilder
#send_keys(element, keys, device: nil) ⇒ ActionBuilder
Sends keys to the active element. This differs from calling Element#send_keys(keys) on the active element in two ways:
-
The modifier keys included in this call are not released.
-
There is no attempt to re-focus the element - so send_keys(:tab) for switching elements should work.