selenium-webdriver 3.6.0 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/CHANGES +15 -2
  2. data/lib/selenium-webdriver.rb +0 -2
  3. data/lib/selenium/server.rb +0 -2
  4. data/lib/selenium/webdriver.rb +0 -2
  5. data/lib/selenium/webdriver/chrome.rb +0 -2
  6. data/lib/selenium/webdriver/chrome/driver.rb +0 -2
  7. data/lib/selenium/webdriver/chrome/options.rb +0 -2
  8. data/lib/selenium/webdriver/chrome/profile.rb +0 -2
  9. data/lib/selenium/webdriver/chrome/service.rb +0 -2
  10. data/lib/selenium/webdriver/common.rb +0 -3
  11. data/lib/selenium/webdriver/common/action_builder.rb +0 -2
  12. data/lib/selenium/webdriver/common/alert.rb +0 -2
  13. data/lib/selenium/webdriver/common/bridge_helper.rb +0 -2
  14. data/lib/selenium/webdriver/common/driver.rb +0 -2
  15. data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +0 -2
  16. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +0 -2
  17. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +0 -2
  18. data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +0 -2
  19. data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +0 -2
  20. data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +0 -2
  21. data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +0 -2
  22. data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +0 -2
  23. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +0 -2
  24. data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +0 -2
  25. data/lib/selenium/webdriver/common/element.rb +0 -2
  26. data/lib/selenium/webdriver/common/error.rb +195 -94
  27. data/lib/selenium/webdriver/common/file_reaper.rb +0 -2
  28. data/lib/selenium/webdriver/common/html5/local_storage.rb +0 -2
  29. data/lib/selenium/webdriver/common/html5/session_storage.rb +0 -2
  30. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +1 -3
  31. data/lib/selenium/webdriver/common/interactions/input_device.rb +0 -2
  32. data/lib/selenium/webdriver/common/interactions/interaction.rb +0 -2
  33. data/lib/selenium/webdriver/common/interactions/interactions.rb +0 -2
  34. data/lib/selenium/webdriver/common/interactions/key_actions.rb +0 -2
  35. data/lib/selenium/webdriver/common/interactions/key_input.rb +0 -2
  36. data/lib/selenium/webdriver/common/interactions/none_input.rb +0 -2
  37. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +0 -2
  38. data/lib/selenium/webdriver/common/interactions/pointer_input.rb +0 -2
  39. data/lib/selenium/webdriver/common/keyboard.rb +0 -2
  40. data/lib/selenium/webdriver/common/keys.rb +1 -3
  41. data/lib/selenium/webdriver/common/log_entry.rb +0 -2
  42. data/lib/selenium/webdriver/common/logger.rb +0 -2
  43. data/lib/selenium/webdriver/common/logs.rb +0 -2
  44. data/lib/selenium/webdriver/common/mouse.rb +0 -2
  45. data/lib/selenium/webdriver/common/navigation.rb +0 -2
  46. data/lib/selenium/webdriver/common/options.rb +0 -2
  47. data/lib/selenium/webdriver/common/platform.rb +0 -2
  48. data/lib/selenium/webdriver/common/port_prober.rb +0 -2
  49. data/lib/selenium/webdriver/common/profile_helper.rb +1 -3
  50. data/lib/selenium/webdriver/common/proxy.rb +1 -3
  51. data/lib/selenium/webdriver/common/search_context.rb +0 -2
  52. data/lib/selenium/webdriver/common/service.rb +0 -2
  53. data/lib/selenium/webdriver/common/socket_lock.rb +0 -2
  54. data/lib/selenium/webdriver/common/socket_poller.rb +0 -2
  55. data/lib/selenium/webdriver/common/target_locator.rb +0 -2
  56. data/lib/selenium/webdriver/common/timeouts.rb +0 -2
  57. data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -2
  58. data/lib/selenium/webdriver/common/touch_screen.rb +0 -2
  59. data/lib/selenium/webdriver/common/w3c_action_builder.rb +0 -2
  60. data/lib/selenium/webdriver/common/w3c_options.rb +0 -2
  61. data/lib/selenium/webdriver/common/wait.rb +0 -2
  62. data/lib/selenium/webdriver/common/window.rb +0 -2
  63. data/lib/selenium/webdriver/common/zipper.rb +0 -2
  64. data/lib/selenium/webdriver/edge.rb +0 -2
  65. data/lib/selenium/webdriver/edge/bridge.rb +0 -2
  66. data/lib/selenium/webdriver/edge/driver.rb +0 -2
  67. data/lib/selenium/webdriver/edge/service.rb +0 -2
  68. data/lib/selenium/webdriver/firefox.rb +0 -2
  69. data/lib/selenium/webdriver/firefox/binary.rb +0 -2
  70. data/lib/selenium/webdriver/firefox/driver.rb +0 -2
  71. data/lib/selenium/webdriver/firefox/extension.rb +0 -2
  72. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  73. data/lib/selenium/webdriver/firefox/launcher.rb +0 -2
  74. data/lib/selenium/webdriver/firefox/legacy/driver.rb +0 -2
  75. data/lib/selenium/webdriver/firefox/marionette/bridge.rb +0 -2
  76. data/lib/selenium/webdriver/firefox/marionette/driver.rb +0 -2
  77. data/lib/selenium/webdriver/firefox/options.rb +12 -2
  78. data/lib/selenium/webdriver/firefox/profile.rb +0 -4
  79. data/lib/selenium/webdriver/firefox/profiles_ini.rb +0 -2
  80. data/lib/selenium/webdriver/firefox/service.rb +0 -2
  81. data/lib/selenium/webdriver/firefox/util.rb +0 -2
  82. data/lib/selenium/webdriver/ie.rb +0 -2
  83. data/lib/selenium/webdriver/ie/driver.rb +0 -2
  84. data/lib/selenium/webdriver/ie/options.rb +1 -3
  85. data/lib/selenium/webdriver/ie/service.rb +0 -2
  86. data/lib/selenium/webdriver/phantomjs.rb +0 -2
  87. data/lib/selenium/webdriver/phantomjs/driver.rb +0 -2
  88. data/lib/selenium/webdriver/phantomjs/service.rb +0 -2
  89. data/lib/selenium/webdriver/remote.rb +0 -2
  90. data/lib/selenium/webdriver/remote/bridge.rb +1 -3
  91. data/lib/selenium/webdriver/remote/capabilities.rb +0 -2
  92. data/lib/selenium/webdriver/remote/driver.rb +0 -2
  93. data/lib/selenium/webdriver/remote/http/common.rb +0 -2
  94. data/lib/selenium/webdriver/remote/http/curb.rb +0 -2
  95. data/lib/selenium/webdriver/remote/http/default.rb +1 -3
  96. data/lib/selenium/webdriver/remote/http/persistent.rb +0 -2
  97. data/lib/selenium/webdriver/remote/oss/bridge.rb +0 -2
  98. data/lib/selenium/webdriver/remote/oss/commands.rb +0 -2
  99. data/lib/selenium/webdriver/remote/response.rb +0 -2
  100. data/lib/selenium/webdriver/remote/server_error.rb +0 -2
  101. data/lib/selenium/webdriver/remote/w3c/bridge.rb +0 -2
  102. data/lib/selenium/webdriver/remote/w3c/capabilities.rb +0 -2
  103. data/lib/selenium/webdriver/remote/w3c/commands.rb +0 -2
  104. data/lib/selenium/webdriver/safari.rb +0 -2
  105. data/lib/selenium/webdriver/safari/driver.rb +0 -2
  106. data/lib/selenium/webdriver/safari/service.rb +0 -2
  107. data/lib/selenium/webdriver/support.rb +0 -2
  108. data/lib/selenium/webdriver/support/abstract_event_listener.rb +0 -2
  109. data/lib/selenium/webdriver/support/block_event_listener.rb +0 -2
  110. data/lib/selenium/webdriver/support/color.rb +0 -2
  111. data/lib/selenium/webdriver/support/escaper.rb +0 -2
  112. data/lib/selenium/webdriver/support/event_firing_bridge.rb +0 -2
  113. data/lib/selenium/webdriver/support/select.rb +0 -2
  114. data/selenium-webdriver.gemspec +2 -3
  115. metadata +103 -93
  116. data/lib/selenium/webdriver/common/w3c_error.rb +0 -204
data/CHANGES CHANGED
@@ -1,4 +1,17 @@
1
- 3.6.0 (2017-09-22)
1
+ 3.7.0 (2017-11-03)
2
+ ==================
3
+
4
+ Ruby:
5
+ * Added //rb:lint task to check codebase using RuboCop (thanks @RustyNail)
6
+ * Fixed codebase to comply more to Ruby community style guide (thanks @RustyNail)
7
+ * Packaged all dependencies to Selenium repository so that non-Ruby committers
8
+ can build and test Ruby bindings easier
9
+ * Update errors list according to latest changes of specification (thanks @jaysonesmith)
10
+
11
+ Firefox:
12
+ * Added Firefox::Options#headless! shortcut to enable headless mode (thanks @franzliedke)
13
+
14
+ 3.6.0 (2017-09-25)
2
15
  ==================
3
16
 
4
17
  Edge:
@@ -28,7 +41,7 @@ Firefox:
28
41
  * Fixed a bug when GeckoDriver error stacktrace was not displayed (issue #3683)
29
42
 
30
43
  Chrome:
31
- * Added workardound for the case when findElements call returns null (issue #4555)
44
+ * Added workaround for the case when findElements call returns null (issue #4555)
32
45
  * Chrome::Driver now includes touch actions by default
33
46
 
34
47
  3.5.1 (2017-08-15)
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -17,7 +15,6 @@
17
15
  # specific language governing permissions and limitations
18
16
  # under the License.
19
17
 
20
- require 'selenium/webdriver/common/w3c_error'
21
18
  require 'selenium/webdriver/common/error'
22
19
  require 'selenium/webdriver/common/platform'
23
20
  require 'selenium/webdriver/common/proxy'
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
- #
3
1
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
2
  # or more contributor license agreements. See the NOTICE file
5
3
  # distributed with this work for additional information
@@ -20,97 +18,118 @@
20
18
  module Selenium
21
19
  module WebDriver
22
20
  module Error
21
+
22
+ #
23
+ # Returns exception from code (Integer - OSS, String - W3C).
24
+ # @param [Integer, String, nil] code
25
+ #
26
+
27
+ def self.for_code(code)
28
+ case code
29
+ when nil, 0
30
+ nil
31
+ when Integer
32
+ ERRORS.fetch(code)
33
+ when String
34
+ klass_name = code.split(' ').map(&:capitalize).join.sub(/Error$/, '')
35
+ const_get("#{klass_name}Error")
36
+ end
37
+ rescue NameError
38
+ WebDriverError
39
+ end
40
+
23
41
  class WebDriverError < StandardError; end
24
- class UnsupportedOperationError < WebDriverError; end
25
42
 
26
- class IndexOutOfBoundsError < WebDriverError; end # 1
27
- class NoCollectionError < WebDriverError; end # 2
28
- class NoStringError < WebDriverError; end # 3
29
- class NoStringLengthError < WebDriverError; end # 4
30
- class NoStringWrapperError < WebDriverError; end # 5
31
- class NoSuchDriverError < WebDriverError; end # 6
43
+ class IndexOutOfBoundsError < WebDriverError; end # 1
44
+ class NoCollectionError < WebDriverError; end # 2
45
+ class NoStringError < WebDriverError; end # 3
46
+ class NoStringLengthError < WebDriverError; end # 4
47
+ class NoStringWrapperError < WebDriverError; end # 5
48
+ class NoSuchDriverError < WebDriverError; end # 6
32
49
 
33
50
  #
34
- # An element could not be located on the page using the given search
35
- # parameters.
51
+ # An element could not be located on the page using the given search parameters.
36
52
  #
37
53
 
38
54
  class NoSuchElementError < WebDriverError; end # 7
39
55
 
40
56
  #
41
- # A request to switch to a frame could not be satisfied because the
42
- # frame could not be found.
57
+ # A command to switch to a frame could not be satisfied because the frame could not be found.
43
58
  #
44
59
 
45
- class NoSuchFrameError < WebDriverError; end # 8
46
- class UnknownCommandError < WebDriverError; end # 9
60
+ class NoSuchFrameError < WebDriverError; end # 8
47
61
 
48
62
  #
49
- # Indicates that a reference to an element is now "stale" - the element
50
- # no longer appears in the DOM of the page.
63
+ # A command could not be executed because the remote end is not aware of it.
64
+ #
65
+
66
+ class UnknownCommandError < WebDriverError; end # 9
67
+
68
+ #
69
+ # A command failed because the referenced element is no longer attached to the DOM.
51
70
  #
52
71
 
53
72
  class StaleElementReferenceError < WebDriverError; end # 10
54
73
 
55
74
  #
56
- # Raised to indicate that although an element is present on the DOM,
57
- # it is not visible, and so is not able to be interacted with.
75
+ # Raised to indicate that although an element is present on the DOM, it is not visible, and
76
+ # so is not able to be interacted with.
58
77
  #
59
78
 
60
79
  class ElementNotVisibleError < WebDriverError; end # 11
61
80
 
62
81
  #
63
- # Raised when an interaction could not be performed because the element
64
- # is in an invalid state (e.g. attempting to click a disabled element).
82
+ # The target element is in an invalid state, rendering it impossible to interact with, for
83
+ # example if you click a disabled element.
65
84
  #
66
85
 
67
86
  class InvalidElementStateError < WebDriverError; end # 12
68
87
 
69
88
  #
70
- # An unknown server-side error occurred while processing the command.
89
+ # An unknown error occurred in the remote end while processing the command.
71
90
  #
72
91
 
73
- class UnknownError < WebDriverError; end # 13
74
- class ExpectedError < WebDriverError; end # 14
92
+ class UnknownError < WebDriverError; end # 13
93
+ class ExpectedError < WebDriverError; end # 14
75
94
 
76
95
  #
77
96
  # An attempt was made to select an element that cannot be selected.
78
97
  #
79
98
 
80
- class ElementNotSelectableError < WebDriverError; end # 15
81
- class NoSuchDocumentError < WebDriverError; end # 16
99
+ class ElementNotSelectableError < WebDriverError; end # 15
100
+ class NoSuchDocumentError < WebDriverError; end # 16
82
101
 
83
102
  #
84
- # An error occurred while executing user supplied JavaScript.
103
+ # An error occurred while executing JavaScript supplied by the user.
85
104
  #
86
105
 
87
- class JavascriptError < WebDriverError; end # 17
88
- class NoScriptResultError < WebDriverError; end # 18
106
+ class JavascriptError < WebDriverError; end # 17
107
+ class NoScriptResultError < WebDriverError; end # 18
89
108
 
90
109
  #
91
110
  # An error occurred while searching for an element by XPath.
92
111
  #
93
112
 
94
- class XPathLookupError < WebDriverError; end # 19
95
- class NoSuchCollectionError < WebDriverError; end # 20
113
+ class XPathLookupError < WebDriverError; end # 19
114
+ class NoSuchCollectionError < WebDriverError; end # 20
96
115
 
97
116
  #
98
- # Raised when a command does not complete in enough time.
117
+ # An operation did not complete before its timeout expired.
99
118
  #
100
119
 
101
- class TimeOutError < WebDriverError; end # 21
102
- class NullPointerError < WebDriverError; end # 22
103
- class NoSuchWindowError < WebDriverError; end # 23
120
+ class TimeOutError < WebDriverError; end # 21
121
+
122
+ class NullPointerError < WebDriverError; end # 22
123
+ class NoSuchWindowError < WebDriverError; end # 23
104
124
 
105
125
  #
106
- # Raised when attempting to add a cookie under a different domain than
107
- # the current URL.
126
+ # An illegal attempt was made to set a cookie under a different domain than the current page.
108
127
  #
109
128
 
110
129
  class InvalidCookieDomainError < WebDriverError; end # 24
111
130
 
112
131
  #
113
- # Raised when a driver fails to set a cookie.
132
+ # A command to set a cookie's value could not be satisfied.
114
133
  #
115
134
 
116
135
  class UnableToSetCookieError < WebDriverError; end # 25
@@ -121,10 +140,17 @@ module Selenium
121
140
  class UnhandledAlertError < WebDriverError; end # 26
122
141
 
123
142
  #
124
- # Indicates that a user has tried to access an alert when one is not present.
143
+ # An attempt was made to operate on a modal dialog when one was not open:
144
+ #
145
+ # * W3C dialect is NoSuchAlertError
146
+ # * OSS dialect is NoAlertPresentError
147
+ #
148
+ # We want to allow clients to rescue NoSuchAlertError as a superclass for
149
+ # dialect-agnostic implementation, so NoAlertPresentError should inherit from it.
125
150
  #
126
151
 
127
- class NoAlertPresentError < WebDriverError; end # 27
152
+ class NoSuchAlertError < WebDriverError; end
153
+ class NoAlertPresentError < NoSuchAlertError; end # 27
128
154
 
129
155
  #
130
156
  # A script did not complete before its timeout expired.
@@ -139,9 +165,8 @@ module Selenium
139
165
  class InvalidElementCoordinatesError < WebDriverError; end # 29
140
166
 
141
167
  #
142
- # Indicates that IME support is not available. This exception is rasied
143
- # for every IME-related method call if IME support is not available on
144
- # the machine.
168
+ # Indicates that IME support is not available. This exception is rasied for every IME-related
169
+ # method call if IME support is not available on the machine.
145
170
  #
146
171
 
147
172
  class IMENotAvailableError < WebDriverError; end # 30
@@ -153,7 +178,7 @@ module Selenium
153
178
  class IMEEngineActivationFailedError < WebDriverError; end # 31
154
179
 
155
180
  #
156
- # Argument was an invalid selector (e.g. XPath/CSS).
181
+ # Argument was an invalid selector.
157
182
  #
158
183
 
159
184
  class InvalidSelectorError < WebDriverError; end # 32
@@ -165,61 +190,137 @@ module Selenium
165
190
  class SessionNotCreatedError < WebDriverError; end # 33
166
191
 
167
192
  #
168
- # Indicates that the target provided to the actions #move method is
169
- # invalid, e.g. outside of the bounds of the window.
193
+ # The target for mouse interaction is not in the browser's viewport and cannot be brought
194
+ # into that viewport.
170
195
  #
171
196
 
172
197
  class MoveTargetOutOfBoundsError < WebDriverError; end # 34
173
198
 
199
+ #
200
+ # Indicates that the XPath selector is invalid
201
+ #
202
+
203
+ class InvalidXpathSelectorError < WebDriverError; end
204
+ class InvalidXpathSelectorReturnTyperError < WebDriverError; end
205
+
206
+ #
207
+ # A command could not be completed because the element is not pointer or keyboard
208
+ # interactable.
209
+ #
210
+
211
+ class ElementNotInteractableError < WebDriverError; end
212
+
213
+ #
214
+ # The arguments passed to a command are either invalid or malformed.
215
+ #
216
+
217
+ class InvalidArgumentError < WebDriverError; end
218
+
219
+ #
220
+ # No cookie matching the given path name was found amongst the associated cookies of the
221
+ # current browsing context's active document.
222
+ #
223
+
224
+ class NoSuchCookieError < WebDriverError; end
225
+
226
+ #
227
+ # A screen capture was made impossible.
228
+ #
229
+
230
+ class UnableToCaptureScreenError < WebDriverError; end
231
+
232
+ #
233
+ # Occurs if the given session id is not in the list of active sessions, meaning the session
234
+ # either does not exist or that it's not active.
235
+ #
236
+
237
+ class InvalidSessionIdError < WebDriverError; end
238
+
239
+ #
240
+ # A modal dialog was open, blocking this operation.
241
+ #
242
+
243
+ class UnexpectedAlertOpenError < WebDriverError; end
244
+
245
+ #
246
+ # The requested command matched a known URL but did not match an method for that URL.
247
+ #
248
+
249
+ class UnknownMethodError < WebDriverError; end
250
+
251
+ #
252
+ # The Element Click command could not be completed because the element receiving the events
253
+ # is obscuring the element that was requested clicked.
254
+ #
255
+
256
+ class ElementClickInterceptedError < WebDriverError; end
257
+
258
+ #
259
+ # Indicates that a command that should have executed properly cannot be supported for some
260
+ # reason.
261
+ #
262
+
263
+ class UnsupportedOperationError < WebDriverError; end
264
+
265
+ # Aliases for OSS dialect.
266
+ ScriptTimeoutError = ScriptTimeOutError
267
+ NoAlertOpenError = NoAlertPresentError
268
+
269
+ # Aliases for backwards compatibility.
270
+ ObsoleteElementError = StaleElementReferenceError
271
+ UnhandledError = UnknownError
272
+ UnexpectedJavascriptError = JavascriptError
273
+ ElementNotDisplayedError = ElementNotVisibleError
274
+
275
+ #
174
276
  # @api private
175
- ERRORS = [
176
- IndexOutOfBoundsError, # 1
177
- NoCollectionError, # 2
178
- NoStringError, # 3
179
- NoStringLengthError, # 4
180
- NoStringWrapperError, # 5
181
- NoSuchDriverError, # 6
182
- NoSuchElementError, # 7
183
- NoSuchFrameError, # 8
184
- UnknownCommandError, # 9
185
- StaleElementReferenceError, # 10
186
- ElementNotVisibleError, # 11
187
- InvalidElementStateError, # 12
188
- UnknownError, # 13
189
- ExpectedError, # 14
190
- ElementNotSelectableError, # 15
191
- NoSuchDocumentError, # 16
192
- JavascriptError, # 17
193
- NoScriptResultError, # 18
194
- XPathLookupError, # 19
195
- NoSuchCollectionError, # 20
196
- TimeOutError, # 21
197
- NullPointerError, # 22
198
- NoSuchWindowError, # 23
199
- InvalidCookieDomainError, # 24
200
- UnableToSetCookieError, # 25
201
- UnhandledAlertError, # 26
202
- NoAlertPresentError, # 27
203
- ScriptTimeOutError, # 28
204
- InvalidElementCoordinatesError, # 29
205
- IMENotAvailableError, # 30
206
- IMEEngineActivationFailedError, # 31
207
- InvalidSelectorError, # 32
208
- SessionNotCreatedError, # 33
209
- MoveTargetOutOfBoundsError # 34
210
- ].freeze
211
-
212
- class << self
213
- def for_code(code)
214
- return if [nil, 0].include? code
215
- return ERRORS[code - 1] if code.is_a? Integer
216
-
217
- klass_name = code.split(' ').map(&:capitalize).join
218
- Error.const_get("#{klass_name.gsub('Error', '')}Error")
219
- rescue NameError
220
- WebDriverError
221
- end
222
- end
277
+ #
278
+
279
+ ERRORS = {
280
+ 1 => IndexOutOfBoundsError,
281
+ 2 => NoCollectionError,
282
+ 3 => NoStringError,
283
+ 4 => NoStringLengthError,
284
+ 5 => NoStringWrapperError,
285
+ 6 => NoSuchDriverError,
286
+ 7 => NoSuchElementError,
287
+ 8 => NoSuchFrameError,
288
+ 9 => UnknownCommandError,
289
+ 10 => StaleElementReferenceError,
290
+ 11 => ElementNotVisibleError,
291
+ 12 => InvalidElementStateError,
292
+ 13 => UnknownError,
293
+ 14 => ExpectedError,
294
+ 15 => ElementNotSelectableError,
295
+ 16 => NoSuchDocumentError,
296
+ 17 => JavascriptError,
297
+ 18 => NoScriptResultError,
298
+ 19 => XPathLookupError,
299
+ 20 => NoSuchCollectionError,
300
+ 21 => TimeOutError,
301
+ 22 => NullPointerError,
302
+ 23 => NoSuchWindowError,
303
+ 24 => InvalidCookieDomainError,
304
+ 25 => UnableToSetCookieError,
305
+ 26 => UnhandledAlertError,
306
+ 27 => NoAlertPresentError,
307
+ 28 => ScriptTimeOutError,
308
+ 29 => InvalidElementCoordinatesError,
309
+ 30 => IMENotAvailableError,
310
+ 31 => IMEEngineActivationFailedError,
311
+ 32 => InvalidSelectorError,
312
+ 33 => SessionNotCreatedError,
313
+ 34 => MoveTargetOutOfBoundsError,
314
+ # The following are W3C-specific errors,
315
+ # they don't really need error codes, we just make them up!
316
+ 51 => InvalidXpathSelectorError,
317
+ 52 => InvalidXpathSelectorReturnTyperError,
318
+ 60 => ElementNotInteractableError,
319
+ 61 => InvalidArgumentError,
320
+ 62 => NoSuchCookieError,
321
+ 63 => UnableToCaptureScreenError
322
+ }.freeze
323
+
223
324
  end # Error
224
325
  end # WebDriver
225
326
  end # Selenium