selenium-webdriver 3.0.0.beta4.0 → 4.0.0.alpha5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +679 -0
  3. data/Gemfile +2 -0
  4. data/LICENSE +1 -1
  5. data/README.md +1 -1
  6. data/lib/selenium-webdriver.rb +2 -2
  7. data/lib/selenium/server.rb +23 -16
  8. data/lib/selenium/webdriver.rb +43 -25
  9. data/lib/selenium/webdriver/atoms.rb +20 -1
  10. data/lib/selenium/webdriver/atoms/findElements.js +122 -0
  11. data/lib/selenium/webdriver/atoms/getAttribute.js +84 -11
  12. data/lib/selenium/webdriver/atoms/isDisplayed.js +100 -0
  13. data/lib/selenium/webdriver/chrome.rb +15 -20
  14. data/lib/selenium/webdriver/chrome/bridge.rb +29 -66
  15. data/lib/selenium/webdriver/{edge/service.rb → chrome/driver.rb} +19 -22
  16. data/lib/selenium/webdriver/chrome/options.rb +221 -0
  17. data/lib/selenium/webdriver/chrome/profile.rb +6 -7
  18. data/lib/selenium/webdriver/chrome/service.rb +20 -20
  19. data/lib/selenium/webdriver/common.rb +19 -11
  20. data/lib/selenium/webdriver/common/action_builder.rb +98 -246
  21. data/lib/selenium/webdriver/common/alert.rb +2 -7
  22. data/lib/selenium/webdriver/common/driver.rb +89 -51
  23. data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +45 -0
  24. data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +50 -0
  25. data/lib/selenium/webdriver/common/driver_extensions/{has_input_devices.rb → has_debugger.rb} +12 -25
  26. data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +38 -0
  27. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +3 -5
  28. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +51 -0
  29. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +3 -3
  30. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +51 -0
  31. data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +2 -2
  32. data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +2 -2
  33. data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +2 -2
  34. data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +4 -4
  35. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +9 -3
  36. data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +3 -5
  37. data/lib/selenium/webdriver/common/element.rb +32 -10
  38. data/lib/selenium/webdriver/common/error.rb +103 -121
  39. data/lib/selenium/webdriver/common/file_reaper.rb +3 -5
  40. data/lib/selenium/webdriver/common/html5/local_storage.rb +2 -2
  41. data/lib/selenium/webdriver/common/html5/session_storage.rb +2 -2
  42. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +3 -2
  43. data/lib/selenium/webdriver/common/interactions/input_device.rb +54 -0
  44. data/lib/selenium/webdriver/common/interactions/interaction.rb +53 -0
  45. data/lib/selenium/webdriver/{phantomjs.rb → common/interactions/interactions.rb} +17 -20
  46. data/lib/selenium/webdriver/common/interactions/key_actions.rb +145 -0
  47. data/lib/selenium/webdriver/common/interactions/key_input.rb +66 -0
  48. data/lib/selenium/webdriver/common/interactions/none_input.rb +36 -0
  49. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +363 -0
  50. data/lib/selenium/webdriver/common/interactions/pointer_input.rb +139 -0
  51. data/lib/selenium/webdriver/common/keys.rb +37 -15
  52. data/lib/selenium/webdriver/common/log_entry.rb +4 -4
  53. data/lib/selenium/webdriver/common/logger.rb +147 -0
  54. data/lib/selenium/webdriver/common/logs.rb +2 -2
  55. data/lib/selenium/webdriver/common/manager.rb +177 -0
  56. data/lib/selenium/webdriver/common/navigation.rb +2 -2
  57. data/lib/selenium/webdriver/common/options.rb +47 -105
  58. data/lib/selenium/webdriver/common/platform.rb +44 -38
  59. data/lib/selenium/webdriver/common/port_prober.rb +8 -19
  60. data/lib/selenium/webdriver/common/profile_helper.rb +13 -5
  61. data/lib/selenium/webdriver/common/proxy.rb +14 -8
  62. data/lib/selenium/webdriver/common/search_context.rb +16 -20
  63. data/lib/selenium/webdriver/common/service.rb +115 -30
  64. data/lib/selenium/webdriver/common/socket_lock.rb +12 -7
  65. data/lib/selenium/webdriver/common/socket_poller.rb +29 -22
  66. data/lib/selenium/webdriver/common/target_locator.rb +6 -6
  67. data/lib/selenium/webdriver/common/timeouts.rb +2 -2
  68. data/lib/selenium/webdriver/common/wait.rb +14 -8
  69. data/lib/selenium/webdriver/common/window.rb +38 -2
  70. data/lib/selenium/webdriver/common/zipper.rb +3 -5
  71. data/lib/selenium/webdriver/edge.rb +33 -20
  72. data/lib/selenium/webdriver/edge_chrome/bridge.rb +30 -0
  73. data/lib/selenium/webdriver/edge_chrome/driver.rb +38 -0
  74. data/lib/selenium/webdriver/{common/driver_extensions/has_touch_screen.rb → edge_chrome/options.rb} +10 -12
  75. data/lib/selenium/webdriver/edge_chrome/profile.rb +33 -0
  76. data/lib/selenium/webdriver/edge_chrome/service.rb +36 -0
  77. data/lib/selenium/webdriver/edge_html/driver.rb +39 -0
  78. data/lib/selenium/webdriver/edge_html/options.rb +91 -0
  79. data/lib/selenium/webdriver/edge_html/service.rb +47 -0
  80. data/lib/selenium/webdriver/firefox.rb +24 -29
  81. data/lib/selenium/webdriver/firefox/bridge.rb +15 -39
  82. data/lib/selenium/webdriver/firefox/{util.rb → driver.rb} +13 -19
  83. data/lib/selenium/webdriver/firefox/extension.rb +28 -8
  84. data/lib/selenium/webdriver/firefox/options.rb +162 -0
  85. data/lib/selenium/webdriver/firefox/profile.rb +23 -82
  86. data/lib/selenium/webdriver/firefox/profiles_ini.rb +5 -5
  87. data/lib/selenium/webdriver/firefox/service.rb +18 -37
  88. data/lib/selenium/webdriver/ie.rb +13 -19
  89. data/lib/selenium/webdriver/ie/driver.rb +40 -0
  90. data/lib/selenium/webdriver/ie/options.rb +118 -0
  91. data/lib/selenium/webdriver/ie/service.rb +20 -20
  92. data/lib/selenium/webdriver/remote.rb +15 -17
  93. data/lib/selenium/webdriver/remote/bridge.rb +281 -300
  94. data/lib/selenium/webdriver/remote/capabilities.rb +102 -83
  95. data/lib/selenium/webdriver/remote/commands.rb +132 -192
  96. data/lib/selenium/webdriver/remote/driver.rb +52 -0
  97. data/lib/selenium/webdriver/remote/http/common.rb +23 -13
  98. data/lib/selenium/webdriver/remote/http/curb.rb +10 -7
  99. data/lib/selenium/webdriver/remote/http/default.rb +52 -32
  100. data/lib/selenium/webdriver/remote/http/persistent.rb +8 -4
  101. data/lib/selenium/webdriver/remote/response.rb +32 -35
  102. data/lib/selenium/webdriver/remote/server_error.rb +2 -2
  103. data/lib/selenium/webdriver/safari.rb +24 -22
  104. data/lib/selenium/webdriver/safari/bridge.rb +21 -21
  105. data/lib/selenium/webdriver/safari/driver.rb +41 -0
  106. data/lib/selenium/webdriver/safari/options.rb +66 -0
  107. data/lib/selenium/webdriver/safari/service.rb +8 -24
  108. data/lib/selenium/webdriver/support.rb +3 -2
  109. data/lib/selenium/webdriver/support/abstract_event_listener.rb +2 -2
  110. data/lib/selenium/webdriver/support/block_event_listener.rb +3 -3
  111. data/lib/selenium/webdriver/support/color.rb +13 -13
  112. data/lib/selenium/webdriver/support/escaper.rb +2 -2
  113. data/lib/selenium/webdriver/support/event_firing_bridge.rb +4 -4
  114. data/lib/selenium/webdriver/support/relative_locator.rb +51 -0
  115. data/lib/selenium/webdriver/support/select.rb +20 -21
  116. data/lib/selenium/webdriver/version.rb +24 -0
  117. data/selenium-webdriver.gemspec +31 -17
  118. metadata +331 -248
  119. data/lib/selenium/webdriver/common/bridge_helper.rb +0 -82
  120. data/lib/selenium/webdriver/common/keyboard.rb +0 -69
  121. data/lib/selenium/webdriver/common/mouse.rb +0 -88
  122. data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -81
  123. data/lib/selenium/webdriver/common/touch_screen.rb +0 -121
  124. data/lib/selenium/webdriver/common/w3c_error.rb +0 -191
  125. data/lib/selenium/webdriver/edge/bridge.rb +0 -76
  126. data/lib/selenium/webdriver/edge/legacy_support.rb +0 -117
  127. data/lib/selenium/webdriver/firefox/binary.rb +0 -186
  128. data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
  129. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  130. data/lib/selenium/webdriver/firefox/launcher.rb +0 -114
  131. data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
  132. data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
  133. data/lib/selenium/webdriver/firefox/w3c_bridge.rb +0 -79
  134. data/lib/selenium/webdriver/ie/bridge.rb +0 -76
  135. data/lib/selenium/webdriver/phantomjs/bridge.rb +0 -65
  136. data/lib/selenium/webdriver/phantomjs/service.rb +0 -66
  137. data/lib/selenium/webdriver/remote/w3c_bridge.rb +0 -682
  138. data/lib/selenium/webdriver/remote/w3c_capabilities.rb +0 -228
  139. data/lib/selenium/webdriver/remote/w3c_commands.rb +0 -135
@@ -1,5 +1,5 @@
1
- # encoding: utf-8
2
- #
1
+ # frozen_string_literal: true
2
+
3
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
4
  # or more contributor license agreements. See the NOTICE file
5
5
  # distributed with this work for additional information
@@ -50,7 +50,7 @@ module Selenium
50
50
  end
51
51
 
52
52
  def valid_type?(type)
53
- type_to_values.keys.include? type
53
+ type_to_values.key? type
54
54
  end
55
55
  end # HasNetworkConnection
56
56
  end # DriverExtensions
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed to the Software Freedom Conservancy (SFC) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The SFC licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+
20
+ module Selenium
21
+ module WebDriver
22
+ module DriverExtensions
23
+ module HasPermissions
24
+
25
+ #
26
+ # Returns permissions.
27
+ #
28
+ # @return [Hash]
29
+ #
30
+
31
+ def permissions
32
+ @bridge.permissions
33
+ end
34
+
35
+ #
36
+ # Sets permissions.
37
+ #
38
+ # @example
39
+ # driver.permissions = {'getUserMedia' => true}
40
+ #
41
+ # @param [Hash<Symbol, Boolean>] permissions
42
+ #
43
+
44
+ def permissions=(permissions)
45
+ @bridge.permissions = permissions
46
+ end
47
+
48
+ end # HasPermissions
49
+ end # DriverExtensions
50
+ end # WebDriver
51
+ end # Selenium
@@ -1,5 +1,5 @@
1
- # encoding: utf-8
2
- #
1
+ # frozen_string_literal: true
2
+
3
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
4
  # or more contributor license agreements. See the NOTICE file
5
5
  # distributed with this work for additional information
@@ -1,5 +1,5 @@
1
- # encoding: utf-8
2
- #
1
+ # frozen_string_literal: true
2
+
3
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
4
  # or more contributor license agreements. See the NOTICE file
5
5
  # distributed with this work for additional information
@@ -1,5 +1,5 @@
1
- # encoding: utf-8
2
- #
1
+ # frozen_string_literal: true
2
+
3
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
4
  # or more contributor license agreements. See the NOTICE file
5
5
  # distributed with this work for additional information
@@ -1,5 +1,5 @@
1
- # encoding: utf-8
2
- #
1
+ # frozen_string_literal: true
2
+
3
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
4
  # or more contributor license agreements. See the NOTICE file
5
5
  # distributed with this work for additional information
@@ -25,12 +25,12 @@ module Selenium
25
25
 
26
26
  module DriverExtensions
27
27
  module Rotatable
28
- ORIENTATIONS = [:landscape, :portrait].freeze
28
+ ORIENTATIONS = %i[landscape portrait].freeze
29
29
 
30
30
  #
31
31
  # Change the screen orientation
32
32
  #
33
- # @param [:landscape, :portrait] Orientation
33
+ # @param [:landscape, :portrait] orientation
34
34
  #
35
35
  # @api public
36
36
  #
@@ -1,5 +1,5 @@
1
- # encoding: utf-8
2
- #
1
+ # frozen_string_literal: true
2
+
3
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
4
  # or more contributor license agreements. See the NOTICE file
5
5
  # distributed with this work for additional information
@@ -32,6 +32,12 @@ module Selenium
32
32
  #
33
33
 
34
34
  def save_screenshot(png_path)
35
+ extension = File.extname(png_path).downcase
36
+ if extension != '.png'
37
+ WebDriver.logger.warn "name used for saved screenshot does not match file type. "\
38
+ "It should end with .png extension",
39
+ id: :screenshot
40
+ end
35
41
  File.open(png_path, 'wb') { |f| f << screenshot_as(:png) }
36
42
  end
37
43
 
@@ -48,7 +54,7 @@ module Selenium
48
54
  when :base64
49
55
  bridge.screenshot
50
56
  when :png
51
- bridge.screenshot.unpack('m')[0]
57
+ bridge.screenshot.unpack1('m')
52
58
  else
53
59
  raise Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
54
60
  end
@@ -1,5 +1,5 @@
1
- # encoding: utf-8
2
- #
1
+ # frozen_string_literal: true
2
+
3
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
4
  # or more contributor license agreements. See the NOTICE file
5
5
  # distributed with this work for additional information
@@ -50,9 +50,7 @@ module Selenium
50
50
  #
51
51
 
52
52
  def file_detector=(detector)
53
- unless detector.nil? || detector.respond_to?(:call)
54
- raise ArgumentError, 'detector must respond to #call'
55
- end
53
+ raise ArgumentError, 'detector must respond to #call' unless detector.nil? || detector.respond_to?(:call)
56
54
 
57
55
  bridge.file_detector = detector
58
56
  end
@@ -1,5 +1,5 @@
1
- # encoding: utf-8
2
- #
1
+ # frozen_string_literal: true
2
+
3
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
4
  # or more contributor license agreements. See the NOTICE file
5
5
  # distributed with this work for additional information
@@ -20,6 +20,8 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  class Element
23
+ ELEMENT_KEY = 'element-6066-11e4-a52e-4f735466cecf'
24
+
23
25
  include SearchContext
24
26
 
25
27
  #
@@ -34,7 +36,7 @@ module Selenium
34
36
  end
35
37
 
36
38
  def inspect
37
- format '#<%s:0x%x id=%s>', self.class, hash * 2, @id.inspect
39
+ format '#<%<class>s:0x%<hash>x id=%<id>s>', class: self.class, hash: hash * 2, id: @id.inspect
38
40
  end
39
41
 
40
42
  def ==(other)
@@ -108,16 +110,26 @@ module Selenium
108
110
  #
109
111
  # class, readonly
110
112
  #
111
- # @param [String]
112
- # attribute name
113
- # @return [String,nil]
114
- # attribute value
113
+ # @param [String] name attribute name
114
+ # @return [String, nil] attribute value
115
115
  #
116
116
 
117
117
  def attribute(name)
118
118
  bridge.element_attribute self, name
119
119
  end
120
120
 
121
+ #
122
+ # Get the value of a the given property with the same name of the element. If the value is not
123
+ # set, nil is returned.
124
+ #
125
+ # @param [String] name property name
126
+ # @return [String, nil] property value
127
+ #
128
+
129
+ def property(name)
130
+ bridge.element_property self, name
131
+ end
132
+
121
133
  #
122
134
  # Get the text content of this element
123
135
  #
@@ -131,7 +143,7 @@ module Selenium
131
143
  #
132
144
  # Send keystrokes to this element
133
145
  #
134
- # @param [String, Symbol, Array]
146
+ # @param [String, Symbol, Array] args keystrokes to send
135
147
  #
136
148
  # Examples:
137
149
  #
@@ -188,7 +200,7 @@ module Selenium
188
200
  #
189
201
 
190
202
  def displayed?
191
- bridge.element_displayed? @id
203
+ bridge.element_displayed? self
192
204
  end
193
205
 
194
206
  #
@@ -225,6 +237,16 @@ module Selenium
225
237
  bridge.element_location @id
226
238
  end
227
239
 
240
+ #
241
+ # Get the dimensions and coordinates of this element.
242
+ #
243
+ # @return [WebDriver::Rectangle]
244
+ #
245
+
246
+ def rect
247
+ bridge.element_rect @id
248
+ end
249
+
228
250
  #
229
251
  # Determine an element's location on the screen once it has been scrolled into view.
230
252
  #
@@ -292,7 +314,7 @@ module Selenium
292
314
  #
293
315
 
294
316
  def as_json(*)
295
- @id.is_a?(Hash) ? @id : {:ELEMENT => @id}
317
+ @id.is_a?(Hash) ? @id : {ELEMENT_KEY => @id}
296
318
  end
297
319
 
298
320
  private
@@ -1,5 +1,5 @@
1
- # encoding: utf-8
2
- #
1
+ # frozen_string_literal: true
2
+
3
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
4
  # or more contributor license agreements. See the NOTICE file
5
5
  # distributed with this work for additional information
@@ -20,206 +20,188 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Error
23
+
24
+ #
25
+ # Returns exception from its string representation.
26
+ # @param [String, nil] error
27
+ #
28
+
29
+ def self.for_error(error)
30
+ return if error.nil?
31
+
32
+ klass_name = error.split(' ').map(&:capitalize).join.sub(/Error$/, '')
33
+ const_get("#{klass_name}Error", false)
34
+ rescue NameError
35
+ WebDriverError
36
+ end
37
+
23
38
  class WebDriverError < StandardError; end
24
- class UnsupportedOperationError < WebDriverError; end
25
39
 
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
40
+ #
41
+ # An element could not be located on the page using the given search parameters.
42
+ #
43
+
44
+ class NoSuchElementError < WebDriverError; end
32
45
 
33
46
  #
34
- # An element could not be located on the page using the given search
35
- # parameters.
47
+ # A command to switch to a frame could not be satisfied because the frame could not be found.
36
48
  #
37
49
 
38
- class NoSuchElementError < WebDriverError; end # 7
50
+ class NoSuchFrameError < WebDriverError; end
39
51
 
40
52
  #
41
- # A request to switch to a frame could not be satisfied because the
42
- # frame could not be found.
53
+ # A command could not be executed because the remote end is not aware of it.
43
54
  #
44
55
 
45
- class NoSuchFrameError < WebDriverError; end # 8
46
- class UnknownCommandError < WebDriverError; end # 9
56
+ class UnknownCommandError < WebDriverError; end
47
57
 
48
58
  #
49
- # Indicates that a reference to an element is now "stale" - the element
50
- # no longer appears in the DOM of the page.
59
+ # A command failed because the referenced element is no longer attached to the DOM.
51
60
  #
52
61
 
53
- class StaleElementReferenceError < WebDriverError; end # 10
62
+ class StaleElementReferenceError < WebDriverError; end
54
63
 
55
64
  #
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.
65
+ # The target element is in an invalid state, rendering it impossible to interact with, for
66
+ # example if you click a disabled element.
58
67
  #
59
68
 
60
- class ElementNotVisibleError < WebDriverError; end # 11
69
+ class InvalidElementStateError < WebDriverError; end
61
70
 
62
71
  #
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).
72
+ # An unknown error occurred in the remote end while processing the command.
65
73
  #
66
74
 
67
- class InvalidElementStateError < WebDriverError; end # 12
75
+ class UnknownError < WebDriverError; end
68
76
 
69
77
  #
70
- # An unknown server-side error occurred while processing the command.
78
+ # An error occurred while executing JavaScript supplied by the user.
71
79
  #
72
80
 
73
- class UnknownError < WebDriverError; end # 13
74
- class ExpectedError < WebDriverError; end # 14
81
+ class JavascriptError < WebDriverError; end
75
82
 
76
83
  #
77
- # An attempt was made to select an element that cannot be selected.
84
+ # An operation did not complete before its timeout expired.
78
85
  #
79
86
 
80
- class ElementNotSelectableError < WebDriverError; end # 15
81
- class NoSuchDocumentError < WebDriverError; end # 16
87
+ class TimeoutError < WebDriverError; end
82
88
 
83
89
  #
84
- # An error occurred while executing user supplied JavaScript.
90
+ # A command to switch to a window could not be satisfied because
91
+ # the window could not be found.
85
92
  #
86
93
 
87
- class JavascriptError < WebDriverError; end # 17
88
- class NoScriptResultError < WebDriverError; end # 18
94
+ class NoSuchWindowError < WebDriverError; end
89
95
 
90
96
  #
91
- # An error occurred while searching for an element by XPath.
97
+ # An illegal attempt was made to set a cookie under a different domain than the current page.
92
98
  #
93
99
 
94
- class XPathLookupError < WebDriverError; end # 19
95
- class NoSuchCollectionError < WebDriverError; end # 20
100
+ class InvalidCookieDomainError < WebDriverError; end
96
101
 
97
102
  #
98
- # Raised when a command does not complete in enough time.
103
+ # A command to set a cookie's value could not be satisfied.
99
104
  #
100
105
 
101
- class TimeOutError < WebDriverError; end # 21
102
- class NullPointerError < WebDriverError; end # 22
103
- class NoSuchWindowError < WebDriverError; end # 23
106
+ class UnableToSetCookieError < WebDriverError; end
104
107
 
105
108
  #
106
- # Raised when attempting to add a cookie under a different domain than
107
- # the current URL.
109
+ # An attempt was made to operate on a modal dialog when one was not open:
108
110
  #
109
111
 
110
- class InvalidCookieDomainError < WebDriverError; end # 24
112
+ class NoSuchAlertError < WebDriverError; end
111
113
 
112
114
  #
113
- # Raised when a driver fails to set a cookie.
115
+ # A script did not complete before its timeout expired.
114
116
  #
115
117
 
116
- class UnableToSetCookieError < WebDriverError; end # 25
118
+ class ScriptTimeoutError < WebDriverError; end
117
119
 
118
120
  #
119
- # Raised when an alert dialog is present that has not been dealt with.
121
+ # Argument was an invalid selector.
120
122
  #
121
- class UnhandledAlertError < WebDriverError; end # 26
123
+
124
+ class InvalidSelectorError < WebDriverError; end
122
125
 
123
126
  #
124
- # Indicates that a user has tried to access an alert when one is not present.
127
+ # A new session could not be created.
125
128
  #
126
129
 
127
- class NoAlertPresentError < WebDriverError; end # 27
130
+ class SessionNotCreatedError < WebDriverError; end
128
131
 
129
132
  #
130
- # A script did not complete before its timeout expired.
133
+ # The target for mouse interaction is not in the browser's viewport and cannot be brought
134
+ # into that viewport.
131
135
  #
132
136
 
133
- class ScriptTimeOutError < WebDriverError; end # 28
137
+ class MoveTargetOutOfBoundsError < WebDriverError; end
134
138
 
135
139
  #
136
- # The coordinates provided to an interactions operation are invalid.
140
+ # A command could not be completed because the element is not pointer or keyboard
141
+ # interactable.
137
142
  #
138
143
 
139
- class InvalidElementCoordinatesError < WebDriverError; end # 29
144
+ class ElementNotInteractableError < WebDriverError; end
140
145
 
141
146
  #
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.
147
+ # A command could not be completed because TLS certificate is expired
148
+ # or invalid.
145
149
  #
146
150
 
147
- class IMENotAvailableError < WebDriverError; end # 30
151
+ class InsecureCertificateError < WebDriverError; end
148
152
 
149
153
  #
150
- # Indicates that activating an IME engine has failed.
154
+ # The arguments passed to a command are either invalid or malformed.
151
155
  #
152
156
 
153
- class IMEEngineActivationFailedError < WebDriverError; end # 31
157
+ class InvalidArgumentError < WebDriverError; end
154
158
 
155
159
  #
156
- # Argument was an invalid selector (e.g. XPath/CSS).
160
+ # No cookie matching the given path name was found amongst the associated cookies of the
161
+ # current browsing context's active document.
157
162
  #
158
163
 
159
- class InvalidSelectorError < WebDriverError; end # 32
164
+ class NoSuchCookieError < WebDriverError; end
160
165
 
161
166
  #
162
- # A new session could not be created.
167
+ # A screen capture was made impossible.
163
168
  #
164
169
 
165
- class SessionNotCreatedError < WebDriverError; end # 33
166
-
167
- #
168
- # Indicates that the target provided to the actions #move method is
169
- # invalid, e.g. outside of the bounds of the window.
170
- #
171
-
172
- class MoveTargetOutOfBoundsError < WebDriverError; end # 34
173
-
174
- # @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? Fixnum
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
170
+ class UnableToCaptureScreenError < WebDriverError; end
171
+
172
+ #
173
+ # Occurs if the given session id is not in the list of active sessions, meaning the session
174
+ # either does not exist or that it's not active.
175
+ #
176
+
177
+ class InvalidSessionIdError < WebDriverError; end
178
+
179
+ #
180
+ # A modal dialog was open, blocking this operation.
181
+ #
182
+
183
+ class UnexpectedAlertOpenError < WebDriverError; end
184
+
185
+ #
186
+ # The requested command matched a known URL but did not match an method for that URL.
187
+ #
188
+
189
+ class UnknownMethodError < WebDriverError; end
190
+
191
+ #
192
+ # The Element Click command could not be completed because the element receiving the events
193
+ # is obscuring the element that was requested clicked.
194
+ #
195
+
196
+ class ElementClickInterceptedError < WebDriverError; end
197
+
198
+ #
199
+ # Indicates that a command that should have executed properly cannot be supported for some
200
+ # reason.
201
+ #
202
+
203
+ class UnsupportedOperationError < WebDriverError; end
204
+
223
205
  end # Error
224
206
  end # WebDriver
225
207
  end # Selenium