selenium-webdriver 3.141.0 → 3.142.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +150 -0
  3. data/Gemfile +2 -0
  4. data/LICENSE +1 -1
  5. data/lib/selenium/server.rb +9 -7
  6. data/lib/selenium/webdriver/atoms/getAttribute.js +6 -7
  7. data/lib/selenium/webdriver/atoms/isDisplayed.js +60 -59
  8. data/lib/selenium/webdriver/atoms.rb +20 -1
  9. data/lib/selenium/webdriver/chrome/bridge.rb +23 -3
  10. data/lib/selenium/webdriver/chrome/driver.rb +30 -20
  11. data/lib/selenium/webdriver/chrome/options.rb +11 -7
  12. data/lib/selenium/webdriver/chrome/profile.rb +6 -5
  13. data/lib/selenium/webdriver/chrome/service.rb +13 -13
  14. data/lib/selenium/webdriver/chrome.rb +10 -4
  15. data/lib/selenium/webdriver/common/action_builder.rb +2 -0
  16. data/lib/selenium/webdriver/common/alert.rb +2 -0
  17. data/lib/selenium/webdriver/common/bridge_helper.rb +8 -5
  18. data/lib/selenium/webdriver/common/driver.rb +22 -7
  19. data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +2 -0
  20. data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +2 -0
  21. data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +2 -0
  22. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +3 -3
  23. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +2 -0
  24. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +3 -1
  25. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +2 -0
  26. data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +2 -0
  27. data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +2 -0
  28. data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +2 -0
  29. data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +2 -0
  30. data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +3 -1
  31. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -0
  32. data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +3 -3
  33. data/lib/selenium/webdriver/common/element.rb +3 -1
  34. data/lib/selenium/webdriver/common/error.rb +74 -18
  35. data/lib/selenium/webdriver/common/file_reaper.rb +3 -3
  36. data/lib/selenium/webdriver/common/html5/local_storage.rb +2 -0
  37. data/lib/selenium/webdriver/common/html5/session_storage.rb +2 -0
  38. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +4 -1
  39. data/lib/selenium/webdriver/common/interactions/input_device.rb +3 -0
  40. data/lib/selenium/webdriver/common/interactions/interaction.rb +3 -0
  41. data/lib/selenium/webdriver/common/interactions/interactions.rb +3 -1
  42. data/lib/selenium/webdriver/common/interactions/key_actions.rb +2 -0
  43. data/lib/selenium/webdriver/common/interactions/key_input.rb +4 -0
  44. data/lib/selenium/webdriver/common/interactions/none_input.rb +3 -0
  45. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +2 -0
  46. data/lib/selenium/webdriver/common/interactions/pointer_input.rb +7 -0
  47. data/lib/selenium/webdriver/common/keyboard.rb +4 -1
  48. data/lib/selenium/webdriver/common/keys.rb +3 -0
  49. data/lib/selenium/webdriver/common/log_entry.rb +4 -2
  50. data/lib/selenium/webdriver/common/logger.rb +15 -40
  51. data/lib/selenium/webdriver/common/logs.rb +2 -0
  52. data/lib/selenium/webdriver/common/manager.rb +177 -0
  53. data/lib/selenium/webdriver/common/mouse.rb +3 -0
  54. data/lib/selenium/webdriver/common/navigation.rb +2 -0
  55. data/lib/selenium/webdriver/common/options.rb +28 -126
  56. data/lib/selenium/webdriver/common/platform.rb +26 -30
  57. data/lib/selenium/webdriver/common/port_prober.rb +6 -19
  58. data/lib/selenium/webdriver/common/profile_helper.rb +2 -0
  59. data/lib/selenium/webdriver/common/proxy.rb +13 -5
  60. data/lib/selenium/webdriver/common/search_context.rb +6 -8
  61. data/lib/selenium/webdriver/common/service.rb +87 -29
  62. data/lib/selenium/webdriver/common/socket_lock.rb +10 -3
  63. data/lib/selenium/webdriver/common/socket_poller.rb +26 -18
  64. data/lib/selenium/webdriver/common/target_locator.rb +6 -4
  65. data/lib/selenium/webdriver/common/timeouts.rb +2 -0
  66. data/lib/selenium/webdriver/common/touch_action_builder.rb +5 -6
  67. data/lib/selenium/webdriver/common/touch_screen.rb +4 -1
  68. data/lib/selenium/webdriver/common/w3c_action_builder.rb +3 -0
  69. data/lib/selenium/webdriver/common/{w3c_options.rb → w3c_manager.rb} +3 -1
  70. data/lib/selenium/webdriver/common/wait.rb +13 -5
  71. data/lib/selenium/webdriver/common/window.rb +2 -0
  72. data/lib/selenium/webdriver/common/zipper.rb +3 -3
  73. data/lib/selenium/webdriver/common.rb +5 -2
  74. data/lib/selenium/webdriver/edge/bridge.rb +2 -0
  75. data/lib/selenium/webdriver/edge/driver.rb +6 -13
  76. data/lib/selenium/webdriver/edge/options.rb +3 -0
  77. data/lib/selenium/webdriver/edge/service.rb +8 -12
  78. data/lib/selenium/webdriver/edge.rb +11 -5
  79. data/lib/selenium/webdriver/firefox/binary.rb +9 -8
  80. data/lib/selenium/webdriver/firefox/driver.rb +2 -0
  81. data/lib/selenium/webdriver/firefox/extension.rb +4 -4
  82. data/lib/selenium/webdriver/firefox/launcher.rb +3 -0
  83. data/lib/selenium/webdriver/firefox/legacy/driver.rb +7 -3
  84. data/lib/selenium/webdriver/firefox/marionette/bridge.rb +4 -2
  85. data/lib/selenium/webdriver/firefox/marionette/driver.rb +6 -12
  86. data/lib/selenium/webdriver/firefox/options.rb +22 -9
  87. data/lib/selenium/webdriver/firefox/profile.rb +7 -8
  88. data/lib/selenium/webdriver/firefox/profiles_ini.rb +3 -0
  89. data/lib/selenium/webdriver/firefox/service.rb +8 -19
  90. data/lib/selenium/webdriver/firefox/util.rb +2 -0
  91. data/lib/selenium/webdriver/firefox.rb +10 -4
  92. data/lib/selenium/webdriver/ie/driver.rb +5 -11
  93. data/lib/selenium/webdriver/ie/options.rb +6 -4
  94. data/lib/selenium/webdriver/ie/service.rb +8 -12
  95. data/lib/selenium/webdriver/ie.rb +10 -4
  96. data/lib/selenium/webdriver/remote/bridge.rb +8 -6
  97. data/lib/selenium/webdriver/remote/capabilities.rb +23 -10
  98. data/lib/selenium/webdriver/remote/driver.rb +2 -0
  99. data/lib/selenium/webdriver/remote/http/common.rb +11 -4
  100. data/lib/selenium/webdriver/remote/http/curb.rb +4 -2
  101. data/lib/selenium/webdriver/remote/http/default.rb +31 -25
  102. data/lib/selenium/webdriver/remote/http/persistent.rb +3 -1
  103. data/lib/selenium/webdriver/remote/oss/bridge.rb +5 -2
  104. data/lib/selenium/webdriver/remote/oss/commands.rb +106 -104
  105. data/lib/selenium/webdriver/remote/response.rb +11 -3
  106. data/lib/selenium/webdriver/remote/server_error.rb +2 -0
  107. data/lib/selenium/webdriver/remote/w3c/bridge.rb +28 -13
  108. data/lib/selenium/webdriver/remote/w3c/capabilities.rb +37 -21
  109. data/lib/selenium/webdriver/remote/w3c/commands.rb +61 -58
  110. data/lib/selenium/webdriver/remote.rb +2 -0
  111. data/lib/selenium/webdriver/safari/bridge.rb +5 -3
  112. data/lib/selenium/webdriver/safari/driver.rb +9 -11
  113. data/lib/selenium/webdriver/safari/options.rb +2 -0
  114. data/lib/selenium/webdriver/safari/service.rb +6 -25
  115. data/lib/selenium/webdriver/safari.rb +11 -4
  116. data/lib/selenium/webdriver/support/abstract_event_listener.rb +2 -0
  117. data/lib/selenium/webdriver/support/block_event_listener.rb +3 -1
  118. data/lib/selenium/webdriver/support/color.rb +11 -9
  119. data/lib/selenium/webdriver/support/escaper.rb +2 -0
  120. data/lib/selenium/webdriver/support/event_firing_bridge.rb +3 -1
  121. data/lib/selenium/webdriver/support/select.rb +19 -18
  122. data/lib/selenium/webdriver/support.rb +2 -0
  123. data/lib/selenium/webdriver/version.rb +3 -1
  124. data/lib/selenium/webdriver.rb +3 -1
  125. data/lib/selenium-webdriver.rb +2 -0
  126. data/selenium-webdriver.gemspec +15 -8
  127. metadata +86 -27
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -32,119 +34,120 @@ module Selenium
32
34
  # session handling
33
35
  #
34
36
 
35
- new_session: [:post, 'session'.freeze],
36
- delete_session: [:delete, 'session/:session_id'.freeze],
37
+ new_session: [:post, 'session'],
38
+ delete_session: [:delete, 'session/:session_id'],
37
39
 
38
40
  #
39
41
  # basic driver
40
42
  #
41
43
 
42
- get: [:post, 'session/:session_id/url'.freeze],
43
- get_current_url: [:get, 'session/:session_id/url'.freeze],
44
- back: [:post, 'session/:session_id/back'.freeze],
45
- forward: [:post, 'session/:session_id/forward'.freeze],
46
- refresh: [:post, 'session/:session_id/refresh'.freeze],
47
- get_title: [:get, 'session/:session_id/title'.freeze],
44
+ get: [:post, 'session/:session_id/url'],
45
+ get_current_url: [:get, 'session/:session_id/url'],
46
+ back: [:post, 'session/:session_id/back'],
47
+ forward: [:post, 'session/:session_id/forward'],
48
+ refresh: [:post, 'session/:session_id/refresh'],
49
+ get_title: [:get, 'session/:session_id/title'],
48
50
 
49
51
  #
50
52
  # window and Frame handling
51
53
  #
52
54
 
53
- get_window_handle: [:get, 'session/:session_id/window'.freeze],
54
- close_window: [:delete, 'session/:session_id/window'.freeze],
55
- switch_to_window: [:post, 'session/:session_id/window'.freeze],
56
- get_window_handles: [:get, 'session/:session_id/window/handles'.freeze],
57
- fullscreen_window: [:post, 'session/:session_id/window/fullscreen'.freeze],
58
- minimize_window: [:post, 'session/:session_id/window/minimize'.freeze],
59
- maximize_window: [:post, 'session/:session_id/window/maximize'.freeze],
60
- set_window_size: [:post, 'session/:session_id/window/size'.freeze],
61
- get_window_size: [:get, 'session/:session_id/window/size'.freeze],
62
- set_window_position: [:post, 'session/:session_id/window/position'.freeze],
63
- get_window_position: [:get, 'session/:session_id/window/position'.freeze],
64
- set_window_rect: [:post, 'session/:session_id/window/rect'.freeze],
65
- get_window_rect: [:get, 'session/:session_id/window/rect'.freeze],
66
- switch_to_frame: [:post, 'session/:session_id/frame'.freeze],
67
- switch_to_parent_frame: [:post, 'session/:session_id/frame/parent'.freeze],
55
+ get_window_handle: [:get, 'session/:session_id/window'],
56
+ new_window: [:post, 'session/:session_id/window/new'],
57
+ close_window: [:delete, 'session/:session_id/window'],
58
+ switch_to_window: [:post, 'session/:session_id/window'],
59
+ get_window_handles: [:get, 'session/:session_id/window/handles'],
60
+ fullscreen_window: [:post, 'session/:session_id/window/fullscreen'],
61
+ minimize_window: [:post, 'session/:session_id/window/minimize'],
62
+ maximize_window: [:post, 'session/:session_id/window/maximize'],
63
+ set_window_size: [:post, 'session/:session_id/window/size'],
64
+ get_window_size: [:get, 'session/:session_id/window/size'],
65
+ set_window_position: [:post, 'session/:session_id/window/position'],
66
+ get_window_position: [:get, 'session/:session_id/window/position'],
67
+ set_window_rect: [:post, 'session/:session_id/window/rect'],
68
+ get_window_rect: [:get, 'session/:session_id/window/rect'],
69
+ switch_to_frame: [:post, 'session/:session_id/frame'],
70
+ switch_to_parent_frame: [:post, 'session/:session_id/frame/parent'],
68
71
 
69
72
  #
70
73
  # element
71
74
  #
72
75
 
73
- find_element: [:post, 'session/:session_id/element'.freeze],
74
- find_elements: [:post, 'session/:session_id/elements'.freeze],
75
- find_child_element: [:post, 'session/:session_id/element/:id/element'.freeze],
76
- find_child_elements: [:post, 'session/:session_id/element/:id/elements'.freeze],
77
- get_active_element: [:get, 'session/:session_id/element/active'.freeze],
78
- is_element_selected: [:get, 'session/:session_id/element/:id/selected'.freeze],
79
- get_element_attribute: [:get, 'session/:session_id/element/:id/attribute/:name'.freeze],
80
- get_element_property: [:get, 'session/:session_id/element/:id/property/:name'.freeze],
81
- get_element_css_value: [:get, 'session/:session_id/element/:id/css/:property_name'.freeze],
82
- get_element_text: [:get, 'session/:session_id/element/:id/text'.freeze],
83
- get_element_tag_name: [:get, 'session/:session_id/element/:id/name'.freeze],
84
- get_element_rect: [:get, 'session/:session_id/element/:id/rect'.freeze],
85
- is_element_enabled: [:get, 'session/:session_id/element/:id/enabled'.freeze],
76
+ find_element: [:post, 'session/:session_id/element'],
77
+ find_elements: [:post, 'session/:session_id/elements'],
78
+ find_child_element: [:post, 'session/:session_id/element/:id/element'],
79
+ find_child_elements: [:post, 'session/:session_id/element/:id/elements'],
80
+ get_active_element: [:get, 'session/:session_id/element/active'],
81
+ is_element_selected: [:get, 'session/:session_id/element/:id/selected'],
82
+ get_element_attribute: [:get, 'session/:session_id/element/:id/attribute/:name'],
83
+ get_element_property: [:get, 'session/:session_id/element/:id/property/:name'],
84
+ get_element_css_value: [:get, 'session/:session_id/element/:id/css/:property_name'],
85
+ get_element_text: [:get, 'session/:session_id/element/:id/text'],
86
+ get_element_tag_name: [:get, 'session/:session_id/element/:id/name'],
87
+ get_element_rect: [:get, 'session/:session_id/element/:id/rect'],
88
+ is_element_enabled: [:get, 'session/:session_id/element/:id/enabled'],
86
89
 
87
90
  #
88
91
  # document handling
89
92
  #
90
93
 
91
- get_page_source: [:get, 'session/:session_id/source'.freeze],
92
- execute_script: [:post, 'session/:session_id/execute/sync'.freeze],
93
- execute_async_script: [:post, 'session/:session_id/execute/async'.freeze],
94
+ get_page_source: [:get, 'session/:session_id/source'],
95
+ execute_script: [:post, 'session/:session_id/execute/sync'],
96
+ execute_async_script: [:post, 'session/:session_id/execute/async'],
94
97
 
95
98
  #
96
99
  # cookies
97
100
  #
98
101
 
99
- get_all_cookies: [:get, 'session/:session_id/cookie'.freeze],
100
- get_cookie: [:get, 'session/:session_id/cookie/:name'.freeze],
101
- add_cookie: [:post, 'session/:session_id/cookie'.freeze],
102
- delete_cookie: [:delete, 'session/:session_id/cookie/:name'.freeze],
103
- delete_all_cookies: [:delete, 'session/:session_id/cookie'.freeze],
102
+ get_all_cookies: [:get, 'session/:session_id/cookie'],
103
+ get_cookie: [:get, 'session/:session_id/cookie/:name'],
104
+ add_cookie: [:post, 'session/:session_id/cookie'],
105
+ delete_cookie: [:delete, 'session/:session_id/cookie/:name'],
106
+ delete_all_cookies: [:delete, 'session/:session_id/cookie'],
104
107
 
105
108
  #
106
109
  # timeouts
107
110
  #
108
111
 
109
- set_timeout: [:post, 'session/:session_id/timeouts'.freeze],
112
+ set_timeout: [:post, 'session/:session_id/timeouts'],
110
113
 
111
114
  #
112
115
  # actions
113
116
  #
114
117
 
115
- actions: [:post, 'session/:session_id/actions'.freeze],
116
- release_actions: [:delete, 'session/:session_id/actions'.freeze],
118
+ actions: [:post, 'session/:session_id/actions'],
119
+ release_actions: [:delete, 'session/:session_id/actions'],
117
120
 
118
121
  #
119
122
  # Element Operations
120
123
  #
121
124
 
122
- element_click: [:post, 'session/:session_id/element/:id/click'.freeze],
123
- element_tap: [:post, 'session/:session_id/element/:id/tap'.freeze],
124
- element_clear: [:post, 'session/:session_id/element/:id/clear'.freeze],
125
- element_send_keys: [:post, 'session/:session_id/element/:id/value'.freeze],
125
+ element_click: [:post, 'session/:session_id/element/:id/click'],
126
+ element_tap: [:post, 'session/:session_id/element/:id/tap'],
127
+ element_clear: [:post, 'session/:session_id/element/:id/clear'],
128
+ element_send_keys: [:post, 'session/:session_id/element/:id/value'],
126
129
 
127
130
  #
128
131
  # alerts
129
132
  #
130
133
 
131
- dismiss_alert: [:post, 'session/:session_id/alert/dismiss'.freeze],
132
- accept_alert: [:post, 'session/:session_id/alert/accept'.freeze],
133
- get_alert_text: [:get, 'session/:session_id/alert/text'.freeze],
134
- send_alert_text: [:post, 'session/:session_id/alert/text'.freeze],
134
+ dismiss_alert: [:post, 'session/:session_id/alert/dismiss'],
135
+ accept_alert: [:post, 'session/:session_id/alert/accept'],
136
+ get_alert_text: [:get, 'session/:session_id/alert/text'],
137
+ send_alert_text: [:post, 'session/:session_id/alert/text'],
135
138
 
136
139
  #
137
140
  # screenshot
138
141
  #
139
142
 
140
- take_screenshot: [:get, 'session/:session_id/screenshot'.freeze],
141
- take_element_screenshot: [:get, 'session/:session_id/element/:id/screenshot'.freeze],
143
+ take_screenshot: [:get, 'session/:session_id/screenshot'],
144
+ take_element_screenshot: [:get, 'session/:session_id/element/:id/screenshot'],
142
145
 
143
146
  #
144
147
  # server extensions
145
148
  #
146
149
 
147
- upload_file: [:post, 'session/:session_id/se/file'.freeze]
150
+ upload_file: [:post, 'session/:session_id/se/file']
148
151
  }.freeze
149
152
 
150
153
  end # Bridge
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -22,9 +24,9 @@ module Selenium
22
24
 
23
25
  # https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/WebDriverEndpointDoc/Commands/Commands.html
24
26
  COMMANDS = {
25
- get_permissions: [:get, '/session/:session_id/apple/permissions'.freeze],
26
- set_permissions: [:post, '/session/:session_id/apple/permissions'.freeze],
27
- attach_debugger: [:post, '/session/:session_id/apple/attach_debugger'.freeze]
27
+ get_permissions: [:get, 'session/:session_id/apple/permissions'],
28
+ set_permissions: [:post, 'session/:session_id/apple/permissions'],
29
+ attach_debugger: [:post, 'session/:session_id/apple/attach_debugger']
28
30
  }.freeze
29
31
 
30
32
  def commands(command)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -32,27 +34,23 @@ module Selenium
32
34
  def initialize(opts = {})
33
35
  opts[:desired_capabilities] = create_capabilities(opts)
34
36
 
35
- unless opts.key?(:url)
36
- driver_path = opts.delete(:driver_path) || Safari.driver_path
37
- driver_opts = opts.delete(:driver_opts) || {}
38
- port = opts.delete(:port) || Service::DEFAULT_PORT
39
-
40
- @service = Service.new(driver_path, port, driver_opts)
41
- @service.start
42
- opts[:url] = @service.uri
43
- end
37
+ opts[:url] ||= service_url(opts)
44
38
 
45
39
  listener = opts.delete(:listener)
46
- @bridge = Remote::Bridge.handshake(opts)
40
+ @bridge = Remote::Bridge.handshake(**opts)
47
41
  @bridge.extend Bridge
48
42
 
49
43
  super(@bridge, listener: listener)
50
44
  end
51
45
 
46
+ def browser
47
+ :safari
48
+ end
49
+
52
50
  def quit
53
51
  super
54
52
  ensure
55
- @service.stop if @service
53
+ @service&.stop
56
54
  end
57
55
 
58
56
  private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -23,34 +25,13 @@ module Selenium
23
25
  #
24
26
 
25
27
  class Service < WebDriver::Service
26
- DEFAULT_PORT = 7050
27
- @executable = '/usr/bin/safaridriver'.freeze
28
- @missing_text = <<-ERROR.gsub(/\n +| {2,}/, ' ').freeze
28
+ @default_port = 7050
29
+ @executable = 'safaridriver'
30
+ @missing_text = <<~ERROR
29
31
  Unable to find Apple's safaridriver which comes with Safari 10.
30
32
  More info at https://webkit.org/blog/6900/webdriver-support-in-safari-10/
31
33
  ERROR
32
-
33
- def stop
34
- stop_process
35
- end
36
-
37
- private
38
-
39
- def binary_path(path)
40
- path = self.class.executable if path.nil?
41
- raise Error::WebDriverError, self.class.missing_text unless path
42
- Platform.assert_executable path
43
- path
44
- end
45
-
46
- def start_process
47
- @process = build_process(@executable_path, "--port=#{@port}", *@extra_args)
48
- @process.start
49
- end
50
-
51
- def cannot_connect_error_text
52
- "unable to connect to safaridriver #{@host}:#{@port}"
53
- end
34
+ @shutdown_supported = false
54
35
  end # Service
55
36
  end # Safari
56
37
  end # WebDriver
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -18,7 +20,6 @@
18
20
  require 'selenium/webdriver/safari/bridge'
19
21
  require 'selenium/webdriver/safari/driver'
20
22
  require 'selenium/webdriver/safari/options'
21
- require 'selenium/webdriver/safari/service'
22
23
 
23
24
  module Selenium
24
25
  module WebDriver
@@ -41,18 +42,24 @@ module Selenium
41
42
  @path ||= '/Applications/Safari.app/Contents/MacOS/Safari'
42
43
  return @path if File.file?(@path) && File.executable?(@path)
43
44
  raise Error::WebDriverError, 'Safari is only supported on Mac' unless Platform.os.mac?
45
+
44
46
  raise Error::WebDriverError, 'Unable to find Safari'
45
47
  end
46
48
 
47
49
  def driver_path=(path)
48
- Platform.assert_executable path
49
- @driver_path = path
50
+ WebDriver.logger.deprecate 'Selenium::WebDriver::Safari#driver_path=',
51
+ 'Selenium::WebDriver::Safari::Service#driver_path='
52
+ Selenium::WebDriver::Safari::Service.driver_path = path
50
53
  end
51
54
 
52
55
  def driver_path
53
- @driver_path ||= nil
56
+ WebDriver.logger.deprecate 'Selenium::WebDriver::Safari#driver_path',
57
+ 'Selenium::WebDriver::Safari::Service#driver_path'
58
+ Selenium::WebDriver::Safari::Service.driver_path
54
59
  end
55
60
  end
56
61
  end # Safari
57
62
  end # WebDriver
58
63
  end # Selenium
64
+
65
+ require 'selenium/webdriver/safari/service'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -23,7 +25,7 @@ module Selenium
23
25
  @callback = callback
24
26
  end
25
27
 
26
- def method_missing(meth, *args)
28
+ def method_missing(meth, *args) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
27
29
  @callback.call meth, *args
28
30
  end
29
31
  end # BlockEventListener
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -21,27 +23,27 @@ module Selenium
21
23
  class Color
22
24
  RGB_PATTERN = %r{^\s*rgb\(\s*(\d{1,3})\s*,
23
25
  \s*(\d{1,3})\s*,
24
- \s*(\d{1,3})\s*\)\s*$}x
26
+ \s*(\d{1,3})\s*\)\s*$}x.freeze
25
27
  RGB_PCT_PATTERN = %r{^\s*rgb\(\s*(\d{1,3}|\d{1,2}\.\d+)%\s*,
26
28
  \s*(\d{1,3}|\d{1,2}\.\d+)%\s*,
27
- \s*(\d{1,3}|\d{1,2}\.\d+)%\s*\)\s*$}x
29
+ \s*(\d{1,3}|\d{1,2}\.\d+)%\s*\)\s*$}x.freeze
28
30
  RGBA_PATTERN = %r{^\s*rgba\(\s*(\d{1,3})\s*,
29
31
  \s*(\d{1,3})\s*,
30
32
  \s*(\d{1,3})\s*,
31
- \s*(0|1|0\.\d+)\s*\)\s*$}x
33
+ \s*(0|1|0\.\d+)\s*\)\s*$}x.freeze
32
34
  RGBA_PCT_PATTERN = %r{^\s*rgba\(\s*(\d{1,3}|\d{1,2}\.\d+)
33
35
  %\s*,\s*(\d{1,3}|\d{1,2}\.\d+)
34
36
  %\s*,\s*(\d{1,3}|\d{1,2}\.\d+)
35
- %\s*,\s*(0|1|0\.\d+)\s*\)\s*$}x
36
- HEX_PATTERN = /#(\h{2})(\h{2})(\h{2})/
37
- HEX3_PATTERN = /#(\h)(\h)(\h)/
37
+ %\s*,\s*(0|1|0\.\d+)\s*\)\s*$}x.freeze
38
+ HEX_PATTERN = /#(\h{2})(\h{2})(\h{2})/.freeze
39
+ HEX3_PATTERN = /#(\h)(\h)(\h)/.freeze
38
40
  HSL_PATTERN = %r{^\s*hsl\(\s*(\d{1,3})\s*,
39
41
  \s*(\d{1,3})%\s*,
40
- \s*(\d{1,3})%\s*\)\s*$}x
42
+ \s*(\d{1,3})%\s*\)\s*$}x.freeze
41
43
  HSLA_PATTERN = %r{^\s*hsla\(\s*(\d{1,3})\s*,
42
44
  \s*(\d{1,3})%\s*,
43
45
  \s*(\d{1,3})%\s*,
44
- \s*(0|1|0\.\d+)\s*\)\s*$}x
46
+ \s*(0|1|0\.\d+)\s*\)\s*$}x.freeze
45
47
 
46
48
  attr_reader :red, :green, :blue, :alpha
47
49
 
@@ -70,7 +72,7 @@ module Selenium
70
72
  end
71
73
  end
72
74
 
73
- def self.from_hsl(h, s, l, a)
75
+ def self.from_hsl(h, s, l, a) # rubocop:disable Naming/UncommunicativeMethodParamName
74
76
  h = Float(h) / 360
75
77
  s = Float(s) / 100
76
78
  l = Float(l) / 100
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -118,7 +120,7 @@ module Selenium
118
120
  returned
119
121
  end
120
122
 
121
- def method_missing(meth, *args, &blk)
123
+ def method_missing(meth, *args, &blk) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
122
124
  @delegate.__send__(meth, *args, &blk)
123
125
  end
124
126
  end # EventFiringBridge
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -26,9 +28,7 @@ module Selenium
26
28
  def initialize(element)
27
29
  tag_name = element.tag_name
28
30
 
29
- unless tag_name.casecmp('select').zero?
30
- raise ArgumentError, "unexpected tag name #{tag_name.inspect}"
31
- end
31
+ raise ArgumentError, "unexpected tag name #{tag_name.inspect}" unless tag_name.casecmp('select').zero?
32
32
 
33
33
  @element = element
34
34
  @multi = ![nil, 'false'].include?(element.attribute(:multiple))
@@ -74,6 +74,7 @@ module Selenium
74
74
  def first_selected_option
75
75
  option = options.find(&:selected?)
76
76
  return option if option
77
+
77
78
  raise Error::NoSuchElementError, 'no options are selected'
78
79
  end
79
80
 
@@ -140,9 +141,7 @@ module Selenium
140
141
  #
141
142
 
142
143
  def select_all
143
- unless multiple?
144
- raise Error::UnsupportedOperationError, 'you may only select all options of a multi-select'
145
- end
144
+ raise Error::UnsupportedOperationError, 'you may only select all options of a multi-select' unless multiple?
146
145
 
147
146
  options.each { |e| select_option e }
148
147
  end
@@ -154,9 +153,7 @@ module Selenium
154
153
  #
155
154
 
156
155
  def deselect_all
157
- unless multiple?
158
- raise Error::UnsupportedOperationError, 'you may only deselect all options of a multi-select'
159
- end
156
+ raise Error::UnsupportedOperationError, 'you may only deselect all options of a multi-select' unless multiple?
160
157
 
161
158
  options.each { |e| deselect_option e }
162
159
  end
@@ -167,6 +164,7 @@ module Selenium
167
164
  opts = find_by_text text
168
165
 
169
166
  return select_options(opts) unless opts.empty?
167
+
170
168
  raise Error::NoSuchElementError, "cannot locate element with text: #{text.inspect}"
171
169
  end
172
170
 
@@ -174,6 +172,7 @@ module Selenium
174
172
  opts = find_by_index index
175
173
 
176
174
  return select_option(opts.first) unless opts.empty?
175
+
177
176
  raise Error::NoSuchElementError, "cannot locate element with index: #{index.inspect}"
178
177
  end
179
178
 
@@ -181,36 +180,37 @@ module Selenium
181
180
  opts = find_by_value value
182
181
 
183
182
  return select_options(opts) unless opts.empty?
183
+
184
184
  raise Error::NoSuchElementError, "cannot locate option with value: #{value.inspect}"
185
185
  end
186
186
 
187
187
  def deselect_by_text(text)
188
- unless multiple?
189
- raise Error::UnsupportedOperationError, 'you may only deselect option of a multi-select'
190
- end
188
+ raise Error::UnsupportedOperationError, 'you may only deselect option of a multi-select' unless multiple?
189
+
191
190
  opts = find_by_text text
192
191
 
193
192
  return deselect_options(opts) unless opts.empty?
193
+
194
194
  raise Error::NoSuchElementError, "cannot locate element with text: #{text.inspect}"
195
195
  end
196
196
 
197
197
  def deselect_by_value(value)
198
- unless multiple?
199
- raise Error::UnsupportedOperationError, 'you may only deselect option of a multi-select'
200
- end
198
+ raise Error::UnsupportedOperationError, 'you may only deselect option of a multi-select' unless multiple?
199
+
201
200
  opts = find_by_value value
202
201
 
203
202
  return deselect_options(opts) unless opts.empty?
203
+
204
204
  raise Error::NoSuchElementError, "cannot locate option with value: #{value.inspect}"
205
205
  end
206
206
 
207
207
  def deselect_by_index(index)
208
- unless multiple?
209
- raise Error::UnsupportedOperationError, 'you may only deselect option of a multi-select'
210
- end
208
+ raise Error::UnsupportedOperationError, 'you may only deselect option of a multi-select' unless multiple?
209
+
211
210
  opts = find_by_index index
212
211
 
213
212
  return deselect_option(opts.first) unless opts.empty?
213
+
214
214
  raise Error::NoSuchElementError, "cannot locate option with index: #{index}"
215
215
  end
216
216
 
@@ -253,6 +253,7 @@ module Selenium
253
253
  end
254
254
 
255
255
  return Array(candidates.find { |option| text == option.text }) unless multiple?
256
+
256
257
  candidates.select { |option| text == option.text }
257
258
  end
258
259
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -17,6 +19,6 @@
17
19
 
18
20
  module Selenium
19
21
  module WebDriver
20
- VERSION = '3.141.0'.freeze
22
+ VERSION = '3.142.7'
21
23
  end # WebDriver
22
24
  end # Selenium
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -45,7 +47,7 @@ module Selenium
45
47
  # @api private
46
48
 
47
49
  def self.root
48
- @root ||= File.expand_path('../..', __FILE__)
50
+ @root ||= File.expand_path('..', __dir__)
49
51
  end
50
52
 
51
53
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  root = File.expand_path(File.dirname(__FILE__))
2
4
  raise "cwd must be #{root} when reading gemspec" if root != Dir.pwd
3
5
 
@@ -8,8 +10,8 @@ Gem::Specification.new do |s|
8
10
  s.name = 'selenium-webdriver'
9
11
  s.version = Selenium::WebDriver::VERSION
10
12
 
11
- s.authors = ['Alex Rodionov', 'Titus Fortner']
12
- s.email = ['p0deje@gmail.com', 'titusfortner@gmail.com']
13
+ s.authors = ['Alex Rodionov', 'Titus Fortner', 'Thomas Walpole']
14
+ s.email = ['p0deje@gmail.com', 'titusfortner@gmail.com', 'twalpole@gmail.com']
13
15
 
14
16
  s.summary = 'The next generation developer focused tool for automated testing of webapps'
15
17
  s.description = 'WebDriver is a tool for writing automated tests of websites. ' \
@@ -24,17 +26,22 @@ Gem::Specification.new do |s|
24
26
  }
25
27
 
26
28
  s.required_rubygems_version = Gem::Requirement.new('> 1.3.1') if s.respond_to? :required_rubygems_version=
27
- s.required_ruby_version = Gem::Requirement.new('>= 2.0')
29
+ s.required_ruby_version = Gem::Requirement.new('>= 2.3')
28
30
 
29
31
  s.files = Dir[root + '/**/*'].reject { |e| e =~ /ruby\.iml|build\.desc/ }.map { |e| e.sub(root + '/', '') }
30
32
  s.require_paths = ['lib']
31
33
 
32
- s.add_runtime_dependency 'rubyzip', ['~> 1.2', '>= 1.2.2']
33
- s.add_runtime_dependency 'childprocess', ['~> 0.5']
34
+ s.add_runtime_dependency 'childprocess', ['>= 0.5', '< 4.0']
35
+ s.add_runtime_dependency 'rubyzip', ['>= 1.2.2']
34
36
 
37
+ # childprocess requires ffi on windows but doesn't declare it in its dependencies
38
+ s.add_development_dependency 'ffi'
39
+ s.add_development_dependency 'rack', ['~> 2.0']
40
+ s.add_development_dependency 'rake'
35
41
  s.add_development_dependency 'rspec', ['~> 3.0']
36
- s.add_development_dependency 'rack', ['~> 1.0']
37
- s.add_development_dependency 'webmock', ['~> 2.0']
42
+ s.add_development_dependency 'rubocop', ['~> 0.67.0']
43
+ s.add_development_dependency 'rubocop-performance'
44
+ s.add_development_dependency 'rubocop-rspec'
45
+ s.add_development_dependency 'webmock', ['~> 3.5']
38
46
  s.add_development_dependency 'yard', ['~> 0.9.11']
39
- s.add_development_dependency 'rubocop', ['~> 0.50.0']
40
47
  end