Class: Selenium::WebDriver::Keyboard Private

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/common/keyboard.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(bridge) ⇒ Keyboard

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Keyboard.



7
8
9
# File 'lib/selenium/webdriver/common/keyboard.rb', line 7

def initialize(bridge)
  @bridge = bridge
end

Instance Method Details

#press(key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Release a modifier key



22
23
24
25
26
27
# File 'lib/selenium/webdriver/common/keyboard.rb', line 22

def press(key)
  assert_modifier key

  # TODO: use sendKeysToActiveElement
  @bridge.sendModifierKeyToActiveElement Keys.encode([key]), true
end

#release(key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Release a modifier key



35
36
37
38
39
40
# File 'lib/selenium/webdriver/common/keyboard.rb', line 35

def release(key)
  assert_modifier key

  # TODO: use sendKeysToActiveElement
  @bridge.sendModifierKeyToActiveElement Keys.encode([key]), false
end

#send_keys(*keys) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
14
# File 'lib/selenium/webdriver/common/keyboard.rb', line 11

def send_keys(*keys)
  # TODO: use sendKeysToActiveElement
  @bridge.getActiveElement.send_keys(*keys)
end