selenium-webdriver 2.53.4 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/CHANGES +24 -18
  2. data/README.md +2 -3
  3. data/lib/selenium/server.rb +64 -68
  4. data/lib/selenium/webdriver.rb +5 -9
  5. data/lib/selenium/webdriver/chrome.rb +18 -3
  6. data/lib/selenium/webdriver/chrome/bridge.rb +13 -16
  7. data/lib/selenium/webdriver/chrome/profile.rb +7 -9
  8. data/lib/selenium/webdriver/chrome/service.rb +8 -84
  9. data/lib/selenium/webdriver/common.rb +1 -2
  10. data/lib/selenium/webdriver/common/action_builder.rb +28 -38
  11. data/lib/selenium/webdriver/common/alert.rb +7 -10
  12. data/lib/selenium/webdriver/common/bridge_helper.rb +10 -15
  13. data/lib/selenium/webdriver/common/driver.rb +19 -28
  14. data/lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb +0 -3
  15. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +4 -6
  16. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +4 -5
  17. data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +0 -2
  18. data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +0 -2
  19. data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +0 -2
  20. data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +0 -3
  21. data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +3 -6
  22. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -5
  23. data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +2 -5
  24. data/lib/selenium/webdriver/common/element.rb +27 -29
  25. data/lib/selenium/webdriver/common/error.rb +17 -20
  26. data/lib/selenium/webdriver/common/file_reaper.rb +3 -9
  27. data/lib/selenium/webdriver/common/html5/local_storage.rb +6 -8
  28. data/lib/selenium/webdriver/common/html5/session_storage.rb +6 -8
  29. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +6 -15
  30. data/lib/selenium/webdriver/common/keyboard.rb +7 -12
  31. data/lib/selenium/webdriver/common/keys.rb +67 -69
  32. data/lib/selenium/webdriver/common/log_entry.rb +3 -4
  33. data/lib/selenium/webdriver/common/logs.rb +2 -4
  34. data/lib/selenium/webdriver/common/mouse.rb +9 -12
  35. data/lib/selenium/webdriver/common/navigation.rb +2 -4
  36. data/lib/selenium/webdriver/common/options.rb +16 -19
  37. data/lib/selenium/webdriver/common/platform.rb +61 -90
  38. data/lib/selenium/webdriver/common/port_prober.rb +1 -2
  39. data/lib/selenium/webdriver/common/profile_helper.rb +5 -8
  40. data/lib/selenium/webdriver/common/proxy.rb +58 -70
  41. data/lib/selenium/webdriver/common/search_context.rb +15 -19
  42. data/lib/selenium/webdriver/common/service.rb +127 -0
  43. data/lib/selenium/webdriver/common/socket_lock.rb +5 -11
  44. data/lib/selenium/webdriver/common/socket_poller.rb +4 -9
  45. data/lib/selenium/webdriver/common/target_locator.rb +11 -13
  46. data/lib/selenium/webdriver/common/timeouts.rb +4 -6
  47. data/lib/selenium/webdriver/common/touch_action_builder.rb +2 -4
  48. data/lib/selenium/webdriver/common/touch_screen.rb +15 -18
  49. data/lib/selenium/webdriver/common/w3c_error.rb +3 -6
  50. data/lib/selenium/webdriver/common/wait.rb +6 -11
  51. data/lib/selenium/webdriver/common/window.rb +12 -15
  52. data/lib/selenium/webdriver/common/zipper.rb +6 -8
  53. data/lib/selenium/webdriver/edge.rb +18 -3
  54. data/lib/selenium/webdriver/edge/bridge.rb +11 -16
  55. data/lib/selenium/webdriver/edge/legacy_support.rb +38 -39
  56. data/lib/selenium/webdriver/edge/service.rb +8 -82
  57. data/lib/selenium/webdriver/firefox.rb +25 -6
  58. data/lib/selenium/webdriver/firefox/binary.rb +37 -53
  59. data/lib/selenium/webdriver/firefox/bridge.rb +3 -6
  60. data/lib/selenium/webdriver/firefox/extension.rb +4 -6
  61. data/lib/selenium/webdriver/firefox/extension/prefs.json +1 -10
  62. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  63. data/lib/selenium/webdriver/firefox/launcher.rb +8 -11
  64. data/lib/selenium/webdriver/firefox/profile.rb +40 -42
  65. data/lib/selenium/webdriver/firefox/profiles_ini.rb +8 -15
  66. data/lib/selenium/webdriver/firefox/service.rb +23 -79
  67. data/lib/selenium/webdriver/firefox/util.rb +0 -2
  68. data/lib/selenium/webdriver/firefox/w3c_bridge.rb +2 -4
  69. data/lib/selenium/webdriver/ie.rb +16 -7
  70. data/lib/selenium/webdriver/ie/bridge.rb +16 -23
  71. data/lib/selenium/webdriver/{iphone.rb → ie/service.rb} +26 -4
  72. data/lib/selenium/webdriver/phantomjs.rb +8 -3
  73. data/lib/selenium/webdriver/phantomjs/bridge.rb +9 -11
  74. data/lib/selenium/webdriver/phantomjs/service.rb +17 -81
  75. data/lib/selenium/webdriver/remote.rb +0 -2
  76. data/lib/selenium/webdriver/remote/bridge.rb +193 -191
  77. data/lib/selenium/webdriver/remote/capabilities.rb +60 -90
  78. data/lib/selenium/webdriver/remote/commands.rb +197 -192
  79. data/lib/selenium/webdriver/remote/http/common.rb +15 -13
  80. data/lib/selenium/webdriver/remote/http/curb.rb +5 -9
  81. data/lib/selenium/webdriver/remote/http/default.rb +32 -37
  82. data/lib/selenium/webdriver/remote/http/persistent.rb +4 -6
  83. data/lib/selenium/webdriver/remote/response.rb +13 -21
  84. data/lib/selenium/webdriver/remote/server_error.rb +1 -3
  85. data/lib/selenium/webdriver/remote/w3c_bridge.rb +200 -195
  86. data/lib/selenium/webdriver/remote/w3c_capabilities.rb +38 -46
  87. data/lib/selenium/webdriver/remote/w3c_commands.rb +116 -113
  88. data/lib/selenium/webdriver/safari.rb +23 -7
  89. data/lib/selenium/{client/javascript_frameworks/jquery.rb → webdriver/safari/apple_bridge.rb} +28 -9
  90. data/lib/selenium/webdriver/safari/browser.rb +0 -2
  91. data/lib/selenium/webdriver/safari/{bridge.rb → legacy_bridge.rb} +12 -9
  92. data/lib/selenium/webdriver/safari/options.rb +3 -4
  93. data/lib/selenium/webdriver/safari/resources/client.js +56 -7255
  94. data/lib/selenium/webdriver/safari/server.rb +18 -24
  95. data/lib/selenium/{client/javascript_frameworks/prototype.rb → webdriver/safari/service.rb} +27 -9
  96. data/lib/selenium/webdriver/support.rb +1 -0
  97. data/lib/selenium/webdriver/support/abstract_event_listener.rb +17 -2
  98. data/lib/selenium/webdriver/support/block_event_listener.rb +1 -3
  99. data/lib/selenium/webdriver/support/color.rb +55 -38
  100. data/lib/selenium/webdriver/{android.rb → support/escaper.rb} +19 -4
  101. data/lib/selenium/webdriver/support/event_firing_bridge.rb +36 -38
  102. data/lib/selenium/webdriver/support/select.rb +33 -84
  103. data/selenium-webdriver.gemspec +23 -23
  104. metadata +19 -30
  105. data/lib/selenium-client.rb +0 -21
  106. data/lib/selenium/client.rb +0 -57
  107. data/lib/selenium/client/base.rb +0 -151
  108. data/lib/selenium/client/driver.rb +0 -29
  109. data/lib/selenium/client/errors.rb +0 -28
  110. data/lib/selenium/client/extensions.rb +0 -132
  111. data/lib/selenium/client/idiomatic.rb +0 -507
  112. data/lib/selenium/client/javascript_expression_builder.rb +0 -135
  113. data/lib/selenium/client/legacy_driver.rb +0 -1722
  114. data/lib/selenium/client/protocol.rb +0 -123
  115. data/lib/selenium/client/selenium_helper.rb +0 -49
  116. data/lib/selenium/rake/server_task.rb +0 -176
  117. data/lib/selenium/webdriver/android/bridge.rb +0 -68
  118. data/lib/selenium/webdriver/common/core_ext/base64.rb +0 -28
  119. data/lib/selenium/webdriver/common/core_ext/dir.rb +0 -61
  120. data/lib/selenium/webdriver/common/html5/location.rb +0 -19
  121. data/lib/selenium/webdriver/ie/server.rb +0 -133
  122. data/lib/selenium/webdriver/iphone/bridge.rb +0 -64
@@ -20,7 +20,6 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Error
23
-
24
23
  class WebDriverError < StandardError; end
25
24
  class UnsupportedOperationError < WebDriverError; end
26
25
 
@@ -36,7 +35,7 @@ module Selenium
36
35
  # parameters.
37
36
  #
38
37
 
39
- class NoSuchElementError < WebDriverError; end # 7
38
+ class NoSuchElementError < WebDriverError; end # 7
40
39
 
41
40
  #
42
41
  # A request to switch to a frame could not be satisfied because the
@@ -46,27 +45,26 @@ module Selenium
46
45
  class NoSuchFrameError < WebDriverError; end # 8
47
46
  class UnknownCommandError < WebDriverError; end # 9
48
47
 
49
-
50
48
  #
51
49
  # Indicates that a reference to an element is now "stale" - the element
52
50
  # no longer appears in the DOM of the page.
53
51
  #
54
52
 
55
- class StaleElementReferenceError < WebDriverError; end # 10
53
+ class StaleElementReferenceError < WebDriverError; end # 10
56
54
 
57
55
  #
58
56
  # Raised to indicate that although an element is present on the DOM,
59
57
  # it is not visible, and so is not able to be interacted with.
60
58
  #
61
59
 
62
- class ElementNotVisibleError < WebDriverError; end # 11
60
+ class ElementNotVisibleError < WebDriverError; end # 11
63
61
 
64
62
  #
65
63
  # Raised when an interaction could not be performed because the element
66
64
  # is in an invalid state (e.g. attempting to click a disabled element).
67
65
  #
68
66
 
69
- class InvalidElementStateError < WebDriverError; end # 12
67
+ class InvalidElementStateError < WebDriverError; end # 12
70
68
 
71
69
  #
72
70
  # An unknown server-side error occurred while processing the command.
@@ -109,30 +107,30 @@ module Selenium
109
107
  # the current URL.
110
108
  #
111
109
 
112
- class InvalidCookieDomainError < WebDriverError; end # 24
110
+ class InvalidCookieDomainError < WebDriverError; end # 24
113
111
 
114
112
  #
115
113
  # Raised when a driver fails to set a cookie.
116
114
  #
117
115
 
118
- class UnableToSetCookieError < WebDriverError; end # 25
116
+ class UnableToSetCookieError < WebDriverError; end # 25
119
117
 
120
118
  #
121
119
  # Raised when an alert dialog is present that has not been dealt with.
122
120
  #
123
- class UnhandledAlertError < WebDriverError; end # 26
121
+ class UnhandledAlertError < WebDriverError; end # 26
124
122
 
125
123
  #
126
124
  # Indicates that a user has tried to access an alert when one is not present.
127
125
  #
128
126
 
129
- class NoAlertPresentError < WebDriverError; end # 27
127
+ class NoAlertPresentError < WebDriverError; end # 27
130
128
 
131
129
  #
132
130
  # A script did not complete before its timeout expired.
133
131
  #
134
132
 
135
- class ScriptTimeOutError < WebDriverError; end # 28
133
+ class ScriptTimeOutError < WebDriverError; end # 28
136
134
 
137
135
  #
138
136
  # The coordinates provided to an interactions operation are invalid.
@@ -146,7 +144,7 @@ module Selenium
146
144
  # the machine.
147
145
  #
148
146
 
149
- class IMENotAvailableError < WebDriverError; end # 30
147
+ class IMENotAvailableError < WebDriverError; end # 30
150
148
 
151
149
  #
152
150
  # Indicates that activating an IME engine has failed.
@@ -158,23 +156,23 @@ module Selenium
158
156
  # Argument was an invalid selector (e.g. XPath/CSS).
159
157
  #
160
158
 
161
- class InvalidSelectorError < WebDriverError; end # 32
159
+ class InvalidSelectorError < WebDriverError; end # 32
162
160
 
163
161
  #
164
162
  # A new session could not be created.
165
163
  #
166
164
 
167
- class SessionNotCreatedError < WebDriverError; end # 33
165
+ class SessionNotCreatedError < WebDriverError; end # 33
168
166
 
169
167
  #
170
168
  # Indicates that the target provided to the actions #move method is
171
169
  # invalid, e.g. outside of the bounds of the window.
172
170
  #
173
171
 
174
- class MoveTargetOutOfBoundsError < WebDriverError; end # 34
172
+ class MoveTargetOutOfBoundsError < WebDriverError; end # 34
175
173
 
176
174
  # @api private
177
- Errors = [
175
+ ERRORS = [
178
176
  IndexOutOfBoundsError, # 1
179
177
  NoCollectionError, # 2
180
178
  NoStringError, # 3
@@ -209,20 +207,19 @@ module Selenium
209
207
  InvalidSelectorError, # 32
210
208
  SessionNotCreatedError, # 33
211
209
  MoveTargetOutOfBoundsError # 34
212
- ]
210
+ ].freeze
213
211
 
214
212
  class << self
215
213
  def for_code(code)
216
214
  return if [nil, 0].include? code
217
- return Errors[code - 1] if code.is_a? Fixnum
215
+ return ERRORS[code - 1] if code.is_a? Fixnum
218
216
 
219
217
  klass_name = code.split(' ').map(&:capitalize).join
220
- Error.const_get("#{klass_name.gsub('Error','')}Error")
218
+ Error.const_get("#{klass_name.gsub('Error', '')}Error")
221
219
  rescue NameError
222
220
  WebDriverError
223
221
  end
224
222
  end
225
-
226
223
  end # Error
227
224
  end # WebDriver
228
225
  end # Selenium
@@ -19,21 +19,16 @@
19
19
 
20
20
  module Selenium
21
21
  module WebDriver
22
-
23
22
  #
24
23
  # @api private
25
24
  #
26
25
 
27
26
  module FileReaper
28
-
29
27
  class << self
30
- def reap=(bool)
31
- @reap = bool
32
- end
28
+ attr_writer :reap
33
29
 
34
30
  def reap?
35
- @reap = true unless defined?(@reap)
36
- !!@reap
31
+ @reap = defined?(@reap) ? @reap : true
37
32
  end
38
33
 
39
34
  def tmp_files
@@ -67,7 +62,6 @@ module Selenium
67
62
 
68
63
  # we *do* want child process reaping, so not using Platform.exit_hook here.
69
64
  at_exit { reap! }
70
-
71
65
  end # FileReaper
72
66
  end # WebDriver
73
- end # Selenium
67
+ end # Selenium
@@ -20,7 +20,6 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module HTML5
23
-
24
23
  class LocalStorage
25
24
  include SharedWebStorage
26
25
 
@@ -32,29 +31,28 @@ module Selenium
32
31
  end
33
32
 
34
33
  def [](key)
35
- @bridge.getLocalStorageItem key
34
+ @bridge.local_storage_item key
36
35
  end
37
36
 
38
37
  def []=(key, value)
39
- @bridge.setLocalStorageItem key, value
38
+ @bridge.local_storage_item key, value
40
39
  end
41
40
 
42
41
  def delete(key)
43
- @bridge.removeLocalStorageItem key
42
+ @bridge.remove_local_storage_item key
44
43
  end
45
44
 
46
45
  def clear
47
- @bridge.clearLocalStorage
46
+ @bridge.clear_local_storage
48
47
  end
49
48
 
50
49
  def size
51
- @bridge.getLocalStorageSize
50
+ @bridge.local_storage_size
52
51
  end
53
52
 
54
53
  def keys
55
- @bridge.getLocalStorageKeys.reverse
54
+ @bridge.local_storage_keys.reverse
56
55
  end
57
-
58
56
  end # LocalStorage
59
57
  end # HTML5
60
58
  end # WebDriver
@@ -20,33 +20,32 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module HTML5
23
-
24
23
  class SessionStorage
25
24
  include Enumerable
26
25
  include SharedWebStorage
27
26
 
28
27
  def [](key)
29
- @bridge.getSessionStorageItem key
28
+ @bridge.session_storage_item key
30
29
  end
31
30
 
32
31
  def []=(key, value)
33
- @bridge.setSessionStorageItem key, value
32
+ @bridge.session_storage_item key, value
34
33
  end
35
34
 
36
35
  def delete(key)
37
- @bridge.removeSessionStorageItem key
36
+ @bridge.remove_session_storage_item key
38
37
  end
39
38
 
40
39
  def clear
41
- @bridge.clearSessionStorage
40
+ @bridge.clear_session_storage
42
41
  end
43
42
 
44
43
  def size
45
- @bridge.getSessionStorageSize
44
+ @bridge.session_storage_size
46
45
  end
47
46
 
48
47
  def keys
49
- @bridge.getSessionStorageKeys.reverse
48
+ @bridge.session_storage_keys.reverse
50
49
  end
51
50
 
52
51
  #
@@ -56,7 +55,6 @@ module Selenium
56
55
  def initialize(bridge)
57
56
  @bridge = bridge
58
57
  end
59
-
60
58
  end # SessionStorage
61
59
  end # HTML5
62
60
  end # WebDriver
@@ -20,7 +20,6 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module HTML5
23
-
24
23
  module SharedWebStorage
25
24
  include Enumerable
26
25
 
@@ -30,31 +29,23 @@ module Selenium
30
29
  alias_method :member?, :key?
31
30
  alias_method :has_key?, :key?
32
31
 
33
- def fetch(key, &blk)
34
- if self.key? key
35
- return self[key]
36
- end
37
-
38
- if block_given?
39
- yield key
40
- else
41
- # should be KeyError, but it's 1.9-specific
42
- raise IndexError, "missing key #{key.inspect}"
43
- end
32
+ def fetch(key)
33
+ return self[key] if key? key
34
+ return yield(key) if block_given?
35
+ raise KeyError, "missing key #{key.inspect}"
44
36
  end
45
37
 
46
38
  def empty?
47
- size == 0
39
+ to_a.empty?
48
40
  end
49
41
 
50
- def each(&blk)
42
+ def each
51
43
  return enum_for(:each) unless block_given?
52
44
 
53
45
  keys.each do |k|
54
46
  yield k, self[k]
55
47
  end
56
48
  end
57
-
58
49
  end # SharedWebStorage
59
50
  end # HTML5
60
51
  end # WebDriver
@@ -19,19 +19,17 @@
19
19
 
20
20
  module Selenium
21
21
  module WebDriver
22
-
23
22
  #
24
23
  # @api private
25
24
  # @see ActionBuilder
26
25
 
27
26
  class Keyboard
28
-
29
27
  def initialize(bridge)
30
28
  @bridge = bridge
31
29
  end
32
30
 
33
31
  def send_keys(*keys)
34
- @bridge.sendKeysToActiveElement Keys.encode(keys)
32
+ @bridge.send_keys_to_active_element Keys.encode(keys)
35
33
  end
36
34
 
37
35
  #
@@ -43,7 +41,7 @@ module Selenium
43
41
  def press(key)
44
42
  assert_modifier key
45
43
 
46
- @bridge.sendKeysToActiveElement Keys.encode([key])
44
+ @bridge.send_keys_to_active_element Keys.encode([key])
47
45
  end
48
46
 
49
47
  #
@@ -55,20 +53,17 @@ module Selenium
55
53
  def release(key)
56
54
  assert_modifier key
57
55
 
58
- @bridge.sendKeysToActiveElement Keys.encode([key])
56
+ @bridge.send_keys_to_active_element Keys.encode([key])
59
57
  end
60
58
 
61
59
  private
62
60
 
63
- MODIFIERS = [:control, :shift, :alt, :command, :meta]
61
+ MODIFIERS = [:control, :shift, :alt, :command, :meta].freeze
64
62
 
65
63
  def assert_modifier(key)
66
- unless MODIFIERS.include? key
67
- raise ArgumentError,
68
- "#{key.inspect} is not a modifier key, expected one of #{MODIFIERS.inspect}"
69
- end
64
+ return if MODIFIERS.include? key
65
+ raise ArgumentError, "#{key.inspect} is not a modifier key, expected one of #{MODIFIERS.inspect}"
70
66
  end
71
-
72
67
  end # Keyboard
73
68
  end # WebDriver
74
- end # Selenium
69
+ end # Selenium
@@ -20,85 +20,84 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Keys
23
-
24
23
  #
25
24
  # @see Element#send_keys
26
25
  # @see http://www.google.com.au/search?&q=unicode+pua&btnG=Search
27
26
  #
28
27
 
29
28
  KEYS = {
30
- # \x works on both 1.8.6/1.9
31
- :null => "\xEE\x80\x80",
32
- :cancel => "\xEE\x80\x81",
33
- :help => "\xEE\x80\x82",
34
- :backspace => "\xEE\x80\x83",
35
- :tab => "\xEE\x80\x84",
36
- :clear => "\xEE\x80\x85",
37
- :return => "\xEE\x80\x86",
38
- :enter => "\xEE\x80\x87",
39
- :shift => "\xEE\x80\x88",
40
- :left_shift => "\xEE\x80\x88",
41
- :control => "\xEE\x80\x89",
42
- :left_control => "\xEE\x80\x89",
43
- :alt => "\xEE\x80\x8A",
44
- :left_alt => "\xEE\x80\x8A",
45
- :pause => "\xEE\x80\x8B",
46
- :escape => "\xEE\x80\x8C",
47
- :space => "\xEE\x80\x8D",
48
- :page_up => "\xEE\x80\x8E",
49
- :page_down => "\xEE\x80\x8F",
50
- :end => "\xEE\x80\x90",
51
- :home => "\xEE\x80\x91",
52
- :left => "\xEE\x80\x92",
53
- :arrow_left => "\xEE\x80\x92",
54
- :up => "\xEE\x80\x93",
55
- :arrow_up => "\xEE\x80\x93",
56
- :right => "\xEE\x80\x94",
57
- :arrow_right => "\xEE\x80\x94",
58
- :down => "\xEE\x80\x95",
59
- :arrow_down => "\xEE\x80\x95",
60
- :insert => "\xEE\x80\x96",
61
- :delete => "\xEE\x80\x97",
62
- :semicolon => "\xEE\x80\x98",
63
- :equals => "\xEE\x80\x99",
64
- :numpad0 => "\xEE\x80\x9A",
65
- :numpad1 => "\xEE\x80\x9B",
66
- :numpad2 => "\xEE\x80\x9C",
67
- :numpad3 => "\xEE\x80\x9D",
68
- :numpad4 => "\xEE\x80\x9E",
69
- :numpad5 => "\xEE\x80\x9F",
70
- :numpad6 => "\xEE\x80\xA0",
71
- :numpad7 => "\xEE\x80\xA1",
72
- :numpad8 => "\xEE\x80\xA2",
73
- :numpad9 => "\xEE\x80\xA3",
74
- :multiply => "\xEE\x80\xA4",
75
- :add => "\xEE\x80\xA5",
76
- :separator => "\xEE\x80\xA6",
77
- :subtract => "\xEE\x80\xA7",
78
- :decimal => "\xEE\x80\xA8",
79
- :divide => "\xEE\x80\xA9",
80
- :f1 => "\xEE\x80\xB1",
81
- :f2 => "\xEE\x80\xB2",
82
- :f3 => "\xEE\x80\xB3",
83
- :f4 => "\xEE\x80\xB4",
84
- :f5 => "\xEE\x80\xB5",
85
- :f6 => "\xEE\x80\xB6",
86
- :f7 => "\xEE\x80\xB7",
87
- :f8 => "\xEE\x80\xB8",
88
- :f9 => "\xEE\x80\xB9",
89
- :f10 => "\xEE\x80\xBA",
90
- :f11 => "\xEE\x80\xBB",
91
- :f12 => "\xEE\x80\xBC",
92
- :meta => "\xEE\x80\xBD",
93
- :command => "\xEE\x80\xBD" # alias
94
- }
29
+ null: "\ue000",
30
+ cancel: "\ue001",
31
+ help: "\ue002",
32
+ backspace: "\ue003",
33
+ tab: "\ue004",
34
+ clear: "\ue005",
35
+ return: "\ue006",
36
+ enter: "\ue007",
37
+ shift: "\ue008",
38
+ left_shift: "\ue008",
39
+ control: "\ue009",
40
+ left_control: "\ue009",
41
+ alt: "\ue00A",
42
+ left_alt: "\ue00A",
43
+ pause: "\ue00B",
44
+ escape: "\ue00C",
45
+ space: "\ue00D",
46
+ page_up: "\ue00E",
47
+ page_down: "\ue00F",
48
+ end: "\ue010",
49
+ home: "\ue011",
50
+ left: "\ue012",
51
+ arrow_left: "\ue012",
52
+ up: "\ue013",
53
+ arrow_up: "\ue013",
54
+ right: "\ue014",
55
+ arrow_right: "\ue014",
56
+ down: "\ue015",
57
+ arrow_down: "\ue015",
58
+ insert: "\ue016",
59
+ delete: "\ue017",
60
+ semicolon: "\ue018",
61
+ equals: "\ue019",
62
+ numpad0: "\ue01A",
63
+ numpad1: "\ue01B",
64
+ numpad2: "\ue01C",
65
+ numpad3: "\ue01D",
66
+ numpad4: "\ue01E",
67
+ numpad5: "\ue01F",
68
+ numpad6: "\ue020",
69
+ numpad7: "\ue021",
70
+ numpad8: "\ue022",
71
+ numpad9: "\ue023",
72
+ multiply: "\ue024",
73
+ add: "\ue025",
74
+ separator: "\ue026",
75
+ subtract: "\ue027",
76
+ decimal: "\ue028",
77
+ divide: "\ue029",
78
+ f1: "\ue031",
79
+ f2: "\ue032",
80
+ f3: "\ue033",
81
+ f4: "\ue034",
82
+ f5: "\ue035",
83
+ f6: "\ue036",
84
+ f7: "\ue037",
85
+ f8: "\ue038",
86
+ f9: "\ue039",
87
+ f10: "\ue03A",
88
+ f11: "\ue03B",
89
+ f12: "\ue03C",
90
+ meta: "\ue03D",
91
+ command: "\ue03D" # alias
92
+ }.freeze
95
93
 
96
94
  #
97
95
  # @api private
98
96
  #
99
97
 
100
98
  def self.[](key)
101
- KEYS[key] or raise Error::UnsupportedOperationError, "no such key #{key.inspect}"
99
+ return KEYS[key] if KEYS[key]
100
+ raise Error::UnsupportedOperationError, "no such key #{key.inspect}"
102
101
  end
103
102
 
104
103
  #
@@ -111,7 +110,7 @@ module Selenium
111
110
  when Symbol
112
111
  Keys[arg]
113
112
  when Array
114
- arg = arg.map { |e| e.kind_of?(Symbol) ? Keys[e] : e }.join
113
+ arg = arg.map { |e| e.is_a?(Symbol) ? Keys[e] : e }.join
115
114
  arg << Keys[:null]
116
115
 
117
116
  arg
@@ -120,7 +119,6 @@ module Selenium
120
119
  end
121
120
  end
122
121
  end
123
-
124
122
  end # Keys
125
123
  end # WebDriver
126
124
  end # Selenium