selenium-webdriver 4.0.0.alpha1 → 4.0.0.alpha2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +8 -1
  3. data/lib/selenium/webdriver/version.rb +1 -1
  4. metadata +2 -26
  5. data/lib/selenium/webdriver/common/bridge_helper.rb +0 -82
  6. data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +0 -36
  7. data/lib/selenium/webdriver/common/keyboard.rb +0 -70
  8. data/lib/selenium/webdriver/common/mouse.rb +0 -89
  9. data/lib/selenium/webdriver/common/options.rb +0 -177
  10. data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -78
  11. data/lib/selenium/webdriver/common/touch_screen.rb +0 -123
  12. data/lib/selenium/webdriver/common/w3c_action_builder.rb +0 -212
  13. data/lib/selenium/webdriver/common/w3c_manager.rb +0 -45
  14. data/lib/selenium/webdriver/common/w3c_options.rb +0 -45
  15. data/lib/selenium/webdriver/edge/bridge.rb +0 -76
  16. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  17. data/lib/selenium/webdriver/firefox/launcher.rb +0 -111
  18. data/lib/selenium/webdriver/firefox/legacy/driver.rb +0 -83
  19. data/lib/selenium/webdriver/firefox/marionette/bridge.rb +0 -49
  20. data/lib/selenium/webdriver/firefox/marionette/driver.rb +0 -90
  21. data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
  22. data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
  23. data/lib/selenium/webdriver/firefox/util.rb +0 -46
  24. data/lib/selenium/webdriver/remote/oss/bridge.rb +0 -594
  25. data/lib/selenium/webdriver/remote/oss/commands.rb +0 -223
  26. data/lib/selenium/webdriver/remote/w3c/bridge.rb +0 -605
  27. data/lib/selenium/webdriver/remote/w3c/capabilities.rb +0 -310
  28. data/lib/selenium/webdriver/remote/w3c/commands.rb +0 -157
@@ -1,45 +0,0 @@
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
- class W3COptions < Options
23
-
24
- #
25
- # Get the cookie with the given name
26
- #
27
- # @param [String] name the name of the cookie
28
- # @return [Hash, nil] the cookie, or nil if it wasn't found.
29
- #
30
-
31
- def cookie_named(name)
32
- convert_cookie(@bridge.cookie(name))
33
- end
34
-
35
- #
36
- # Delete all cookies
37
- #
38
-
39
- def delete_all_cookies
40
- @bridge.delete_all_cookies
41
- end
42
-
43
- end # WC3Options
44
- end # WebDriver
45
- end # Selenium
@@ -1,76 +0,0 @@
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 Edge
23
- module Bridge
24
-
25
- def commands(command)
26
- unsupported = %i[execute_script execute_async_script submit_element double_click
27
- mouse_down mouse_up mouse_move_to click
28
- send_keys_to_active_element get_window_handles get_current_window_handle
29
- get_window_size set_window_size get_window_position set_window_position
30
- maximize_window get_alert_text accept_alert dismiss_alert]
31
- if unsupported.include? command
32
- Remote::OSS::Bridge::COMMANDS[command]
33
- else
34
- super
35
- end
36
- end
37
-
38
- def send_keys_to_active_element(key)
39
- execute :send_keys_to_active_element, {}, {value: key}
40
- end
41
-
42
- def window_handle
43
- execute :get_current_window_handle
44
- end
45
-
46
- def window_size(handle = :current)
47
- data = execute :get_window_size, window_handle: handle
48
-
49
- Dimension.new data['width'], data['height']
50
- end
51
-
52
- def resize_window(width, height, handle = :current)
53
- execute :set_window_size, {window_handle: handle},
54
- {width: width,
55
- height: height}
56
- end
57
-
58
- def window_position(handle = :current)
59
- data = execute :get_window_position, window_handle: handle
60
-
61
- Point.new data['x'], data['y']
62
- end
63
-
64
- def reposition_window(x, y, handle = :current)
65
- execute :set_window_position, {window_handle: handle},
66
- {x: x, y: y}
67
- end
68
-
69
- def maximize_window(handle = :current)
70
- execute :maximize_window, window_handle: handle
71
- end
72
-
73
- end # Bridge
74
- end # Edge
75
- end # WebDriver
76
- end # Selenium
@@ -1,111 +0,0 @@
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 Firefox
23
- # @api private
24
- class Launcher
25
- SOCKET_LOCK_TIMEOUT = 45
26
- STABLE_CONNECTION_TIMEOUT = 60
27
-
28
- def initialize(binary, port, profile = nil)
29
- @binary = binary
30
- @port = Integer(port)
31
-
32
- raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
33
-
34
- if profile.is_a? Profile
35
- @profile = profile
36
- else
37
- @profile_name = profile
38
- @profile = nil
39
- end
40
-
41
- @host = '127.0.0.1'
42
- end
43
-
44
- def url
45
- "http://#{@host}:#{@port}/hub"
46
- end
47
-
48
- def launch
49
- socket_lock.locked do
50
- find_free_port
51
- create_profile
52
- start
53
- connect_until_stable
54
- end
55
-
56
- self
57
- end
58
-
59
- def quit
60
- @binary.quit
61
- FileReaper.reap(@profile_dir) if @profile_dir
62
- end
63
-
64
- def find_free_port
65
- @port = PortProber.above @port
66
- end
67
-
68
- def create_profile
69
- fetch_profile unless @profile
70
-
71
- @profile.add_webdriver_extension
72
- @profile.port = @port
73
-
74
- @profile_dir = @profile.layout_on_disk
75
- FileReaper << @profile_dir
76
- end
77
-
78
- def start
79
- assert_profile
80
- @binary.start_with @profile, @profile_dir, '-foreground'
81
- end
82
-
83
- def connect_until_stable
84
- poller = SocketPoller.new(@host, @port, STABLE_CONNECTION_TIMEOUT)
85
-
86
- return if poller.connected?
87
-
88
- @binary.quit
89
- error = "unable to obtain stable firefox connection in #{STABLE_CONNECTION_TIMEOUT} seconds (#{@host}:#{@port})"
90
- raise Error::WebDriverError, error
91
- end
92
-
93
- def fetch_profile
94
- @profile = if @profile_name
95
- Profile.from_name @profile_name
96
- else
97
- Profile.new
98
- end
99
- end
100
-
101
- def assert_profile
102
- raise Error::WebDriverError, 'must create_profile first' unless @profile && @profile_dir
103
- end
104
-
105
- def socket_lock
106
- @socket_lock ||= SocketLock.new(@port - 1, SOCKET_LOCK_TIMEOUT)
107
- end
108
- end # Launcher
109
- end # Firefox
110
- end # WebDriver
111
- end # Selenium
@@ -1,83 +0,0 @@
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 Firefox
23
- module Legacy
24
-
25
- #
26
- # Driver implementation for Firefox using legacy extension.
27
- # @api private
28
- #
29
-
30
- class Driver < WebDriver::Driver
31
- include DriverExtensions::TakesScreenshot
32
-
33
- def initialize(opts = {}) # rubocop:disable Metrics/AbcSize
34
- WebDriver.logger.deprecate 'Selenium support for legacy Firefox', 'Firefox via marionette'
35
-
36
- opts[:desired_capabilities] ||= Remote::Capabilities.firefox_legacy
37
-
38
- if opts.key? :proxy
39
- WebDriver.logger.deprecate ':proxy', "Selenium::WebDriver::Remote::Capabilities.firefox(proxy: #{opts[:proxy]})"
40
- opts[:desired_capabilities].proxy = opts.delete(:proxy)
41
- end
42
-
43
- unless opts.key?(:url)
44
- port = opts.delete(:port) || DEFAULT_PORT
45
- profile = opts.delete(:profile)
46
-
47
- Binary.path = opts[:desired_capabilities][:firefox_binary] if opts[:desired_capabilities][:firefox_binary]
48
- @launcher = Launcher.new Binary.new, port, profile
49
- @launcher.launch
50
- opts[:url] = @launcher.url
51
- end
52
-
53
- listener = opts.delete(:listener)
54
- WebDriver.logger.info 'Skipping handshake as we know it is OSS.'
55
- desired_capabilities = opts.delete(:desired_capabilities)
56
- bridge = Remote::Bridge.new(opts)
57
- capabilities = bridge.create_session(desired_capabilities)
58
- @bridge = Remote::OSS::Bridge.new(capabilities, bridge.session_id, opts)
59
-
60
- begin
61
- super(@bridge, listener: listener)
62
- rescue
63
- @launcher&.quit
64
- raise
65
- end
66
- end
67
-
68
- def browser
69
- :firefox
70
- end
71
-
72
- def quit
73
- super
74
- nil
75
- ensure
76
- @launcher.quit
77
- end
78
-
79
- end # Driver
80
- end # Legacy
81
- end # Firefox
82
- end # WebDriver
83
- end # Selenium
@@ -1,49 +0,0 @@
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 Firefox
23
- module Marionette
24
- module Bridge
25
-
26
- COMMANDS = {
27
- install_addon: [:post, 'session/:session_id/moz/addon/install'],
28
- uninstall_addon: [:post, 'session/:session_id/moz/addon/uninstall']
29
- }.freeze
30
-
31
- def commands(command)
32
- COMMANDS[command] || super
33
- end
34
-
35
- def install_addon(path, temporary)
36
- payload = {path: path}
37
- payload[:temporary] = temporary unless temporary.nil?
38
- execute :install_addon, {}, payload
39
- end
40
-
41
- def uninstall_addon(id)
42
- execute :uninstall_addon, {}, {id: id}
43
- end
44
-
45
- end # Bridge
46
- end # Marionette
47
- end # Firefox
48
- end # WebDriver
49
- end # Selenium
@@ -1,90 +0,0 @@
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 Firefox
23
- module Marionette
24
-
25
- #
26
- # Driver implementation for Firefox using GeckoDriver.
27
- # @api private
28
- #
29
-
30
- class Driver < WebDriver::Driver
31
- include DriverExtensions::HasAddons
32
- include DriverExtensions::HasWebStorage
33
- include DriverExtensions::TakesScreenshot
34
-
35
- def initialize(opts = {})
36
- opts[:desired_capabilities] = create_capabilities(opts)
37
-
38
- opts[:url] ||= service_url(opts)
39
-
40
- listener = opts.delete(:listener)
41
- WebDriver.logger.info 'Skipping handshake as we know it is W3C.'
42
- desired_capabilities = opts.delete(:desired_capabilities)
43
- bridge = Remote::Bridge.new(opts)
44
- capabilities = bridge.create_session(desired_capabilities)
45
- @bridge = Remote::W3C::Bridge.new(capabilities, bridge.session_id, opts)
46
- @bridge.extend Marionette::Bridge
47
-
48
- super(@bridge, listener: listener)
49
- end
50
-
51
- def browser
52
- :firefox
53
- end
54
-
55
- def quit
56
- super
57
- ensure
58
- @service&.stop
59
- end
60
-
61
- private
62
-
63
- def create_capabilities(opts)
64
- caps = opts.delete(:desired_capabilities) { Remote::Capabilities.firefox }
65
- options = opts.delete(:options) { Options.new }
66
-
67
- firefox_options = opts.delete(:firefox_options)
68
- if firefox_options
69
- WebDriver.logger.deprecate ':firefox_options', 'Selenium::WebDriver::Firefox::Options'
70
- firefox_options.each do |key, value|
71
- options.add_option(key, value)
72
- end
73
- end
74
-
75
- profile = opts.delete(:profile)
76
- if profile
77
- WebDriver.logger.deprecate ':profile', 'Selenium::WebDriver::Firefox::Options#profile='
78
- options.profile = profile
79
- end
80
-
81
- options = options.as_json
82
- caps.merge!(options) unless options.empty?
83
-
84
- caps
85
- end
86
- end # Driver
87
- end # Marionette
88
- end # Firefox
89
- end # WebDriver
90
- end # Selenium