Class: Selenium::WebDriver::Keyboard Private

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

Overview

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.

See Also:

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.



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

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.

Press a modifier key



39
40
41
42
43
# File 'lib/selenium/webdriver/common/keyboard.rb', line 39

def press(key)
  assert_modifier key

  @bridge.send_keys_to_active_element Keys.encode([key])
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



51
52
53
54
55
# File 'lib/selenium/webdriver/common/keyboard.rb', line 51

def release(key)
  assert_modifier key

  @bridge.send_keys_to_active_element Keys.encode([key])
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.



29
30
31
# File 'lib/selenium/webdriver/common/keyboard.rb', line 29

def send_keys(*keys)
  @bridge.send_keys_to_active_element Keys.encode(keys)
end