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.
- checksums.yaml +7 -0
- data/CHANGES +679 -0
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/lib/selenium-webdriver.rb +2 -2
- data/lib/selenium/server.rb +23 -16
- data/lib/selenium/webdriver.rb +43 -25
- data/lib/selenium/webdriver/atoms.rb +20 -1
- data/lib/selenium/webdriver/atoms/findElements.js +122 -0
- data/lib/selenium/webdriver/atoms/getAttribute.js +84 -11
- data/lib/selenium/webdriver/atoms/isDisplayed.js +100 -0
- data/lib/selenium/webdriver/chrome.rb +15 -20
- data/lib/selenium/webdriver/chrome/bridge.rb +29 -66
- data/lib/selenium/webdriver/{edge/service.rb → chrome/driver.rb} +19 -22
- data/lib/selenium/webdriver/chrome/options.rb +221 -0
- data/lib/selenium/webdriver/chrome/profile.rb +6 -7
- data/lib/selenium/webdriver/chrome/service.rb +20 -20
- data/lib/selenium/webdriver/common.rb +19 -11
- data/lib/selenium/webdriver/common/action_builder.rb +98 -246
- data/lib/selenium/webdriver/common/alert.rb +2 -7
- data/lib/selenium/webdriver/common/driver.rb +89 -51
- data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +45 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +50 -0
- data/lib/selenium/webdriver/common/driver_extensions/{has_input_devices.rb → has_debugger.rb} +12 -25
- data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +38 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +3 -5
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +51 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +3 -3
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +51 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +2 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +2 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +2 -2
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +4 -4
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +9 -3
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +3 -5
- data/lib/selenium/webdriver/common/element.rb +32 -10
- data/lib/selenium/webdriver/common/error.rb +103 -121
- data/lib/selenium/webdriver/common/file_reaper.rb +3 -5
- data/lib/selenium/webdriver/common/html5/local_storage.rb +2 -2
- data/lib/selenium/webdriver/common/html5/session_storage.rb +2 -2
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +3 -2
- data/lib/selenium/webdriver/common/interactions/input_device.rb +54 -0
- data/lib/selenium/webdriver/common/interactions/interaction.rb +53 -0
- data/lib/selenium/webdriver/{phantomjs.rb → common/interactions/interactions.rb} +17 -20
- data/lib/selenium/webdriver/common/interactions/key_actions.rb +145 -0
- data/lib/selenium/webdriver/common/interactions/key_input.rb +66 -0
- data/lib/selenium/webdriver/common/interactions/none_input.rb +36 -0
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +363 -0
- data/lib/selenium/webdriver/common/interactions/pointer_input.rb +139 -0
- data/lib/selenium/webdriver/common/keys.rb +37 -15
- data/lib/selenium/webdriver/common/log_entry.rb +4 -4
- data/lib/selenium/webdriver/common/logger.rb +147 -0
- data/lib/selenium/webdriver/common/logs.rb +2 -2
- data/lib/selenium/webdriver/common/manager.rb +177 -0
- data/lib/selenium/webdriver/common/navigation.rb +2 -2
- data/lib/selenium/webdriver/common/options.rb +47 -105
- data/lib/selenium/webdriver/common/platform.rb +44 -38
- data/lib/selenium/webdriver/common/port_prober.rb +8 -19
- data/lib/selenium/webdriver/common/profile_helper.rb +13 -5
- data/lib/selenium/webdriver/common/proxy.rb +14 -8
- data/lib/selenium/webdriver/common/search_context.rb +16 -20
- data/lib/selenium/webdriver/common/service.rb +115 -30
- data/lib/selenium/webdriver/common/socket_lock.rb +12 -7
- data/lib/selenium/webdriver/common/socket_poller.rb +29 -22
- data/lib/selenium/webdriver/common/target_locator.rb +6 -6
- data/lib/selenium/webdriver/common/timeouts.rb +2 -2
- data/lib/selenium/webdriver/common/wait.rb +14 -8
- data/lib/selenium/webdriver/common/window.rb +38 -2
- data/lib/selenium/webdriver/common/zipper.rb +3 -5
- data/lib/selenium/webdriver/edge.rb +33 -20
- data/lib/selenium/webdriver/edge_chrome/bridge.rb +30 -0
- data/lib/selenium/webdriver/edge_chrome/driver.rb +38 -0
- data/lib/selenium/webdriver/{common/driver_extensions/has_touch_screen.rb → edge_chrome/options.rb} +10 -12
- data/lib/selenium/webdriver/edge_chrome/profile.rb +33 -0
- data/lib/selenium/webdriver/edge_chrome/service.rb +36 -0
- data/lib/selenium/webdriver/edge_html/driver.rb +39 -0
- data/lib/selenium/webdriver/edge_html/options.rb +91 -0
- data/lib/selenium/webdriver/edge_html/service.rb +47 -0
- data/lib/selenium/webdriver/firefox.rb +24 -29
- data/lib/selenium/webdriver/firefox/bridge.rb +15 -39
- data/lib/selenium/webdriver/firefox/{util.rb → driver.rb} +13 -19
- data/lib/selenium/webdriver/firefox/extension.rb +28 -8
- data/lib/selenium/webdriver/firefox/options.rb +162 -0
- data/lib/selenium/webdriver/firefox/profile.rb +23 -82
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +5 -5
- data/lib/selenium/webdriver/firefox/service.rb +18 -37
- data/lib/selenium/webdriver/ie.rb +13 -19
- data/lib/selenium/webdriver/ie/driver.rb +40 -0
- data/lib/selenium/webdriver/ie/options.rb +118 -0
- data/lib/selenium/webdriver/ie/service.rb +20 -20
- data/lib/selenium/webdriver/remote.rb +15 -17
- data/lib/selenium/webdriver/remote/bridge.rb +281 -300
- data/lib/selenium/webdriver/remote/capabilities.rb +102 -83
- data/lib/selenium/webdriver/remote/commands.rb +132 -192
- data/lib/selenium/webdriver/remote/driver.rb +52 -0
- data/lib/selenium/webdriver/remote/http/common.rb +23 -13
- data/lib/selenium/webdriver/remote/http/curb.rb +10 -7
- data/lib/selenium/webdriver/remote/http/default.rb +52 -32
- data/lib/selenium/webdriver/remote/http/persistent.rb +8 -4
- data/lib/selenium/webdriver/remote/response.rb +32 -35
- data/lib/selenium/webdriver/remote/server_error.rb +2 -2
- data/lib/selenium/webdriver/safari.rb +24 -22
- data/lib/selenium/webdriver/safari/bridge.rb +21 -21
- data/lib/selenium/webdriver/safari/driver.rb +41 -0
- data/lib/selenium/webdriver/safari/options.rb +66 -0
- data/lib/selenium/webdriver/safari/service.rb +8 -24
- data/lib/selenium/webdriver/support.rb +3 -2
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +2 -2
- data/lib/selenium/webdriver/support/block_event_listener.rb +3 -3
- data/lib/selenium/webdriver/support/color.rb +13 -13
- data/lib/selenium/webdriver/support/escaper.rb +2 -2
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +4 -4
- data/lib/selenium/webdriver/support/relative_locator.rb +51 -0
- data/lib/selenium/webdriver/support/select.rb +20 -21
- data/lib/selenium/webdriver/version.rb +24 -0
- data/selenium-webdriver.gemspec +31 -17
- metadata +331 -248
- data/lib/selenium/webdriver/common/bridge_helper.rb +0 -82
- data/lib/selenium/webdriver/common/keyboard.rb +0 -69
- data/lib/selenium/webdriver/common/mouse.rb +0 -88
- data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -81
- data/lib/selenium/webdriver/common/touch_screen.rb +0 -121
- data/lib/selenium/webdriver/common/w3c_error.rb +0 -191
- data/lib/selenium/webdriver/edge/bridge.rb +0 -76
- data/lib/selenium/webdriver/edge/legacy_support.rb +0 -117
- data/lib/selenium/webdriver/firefox/binary.rb +0 -186
- data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/launcher.rb +0 -114
- data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
- data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
- data/lib/selenium/webdriver/firefox/w3c_bridge.rb +0 -79
- data/lib/selenium/webdriver/ie/bridge.rb +0 -76
- data/lib/selenium/webdriver/phantomjs/bridge.rb +0 -65
- data/lib/selenium/webdriver/phantomjs/service.rb +0 -66
- data/lib/selenium/webdriver/remote/w3c_bridge.rb +0 -682
- data/lib/selenium/webdriver/remote/w3c_capabilities.rb +0 -228
- data/lib/selenium/webdriver/remote/w3c_commands.rb +0 -135
@@ -1,76 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
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
|
-
#
|
24
|
-
# @api private
|
25
|
-
#
|
26
|
-
|
27
|
-
class Bridge < Remote::W3CBridge
|
28
|
-
def initialize(opts = {})
|
29
|
-
port = opts.delete(:port) || Service::DEFAULT_PORT
|
30
|
-
service_args = opts.delete(:service_args) || {}
|
31
|
-
unless opts.key?(:url)
|
32
|
-
@service = Service.new(Edge.driver_path, port, *extract_service_args(service_args))
|
33
|
-
@service.host = 'localhost' if @service.host == '127.0.0.1'
|
34
|
-
@service.start
|
35
|
-
opts[:url] = @service.uri
|
36
|
-
end
|
37
|
-
|
38
|
-
opts[:desired_capabilities] ||= Remote::W3CCapabilities.edge
|
39
|
-
|
40
|
-
super(opts)
|
41
|
-
end
|
42
|
-
|
43
|
-
def browser
|
44
|
-
:edge
|
45
|
-
end
|
46
|
-
|
47
|
-
def driver_extensions
|
48
|
-
[
|
49
|
-
DriverExtensions::TakesScreenshot,
|
50
|
-
DriverExtensions::HasInputDevices
|
51
|
-
]
|
52
|
-
end
|
53
|
-
|
54
|
-
def capabilities
|
55
|
-
@capabilities ||= Remote::Capabilities.edge
|
56
|
-
end
|
57
|
-
|
58
|
-
def quit
|
59
|
-
super
|
60
|
-
ensure
|
61
|
-
@service.stop if @service
|
62
|
-
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
def extract_service_args(args = {})
|
67
|
-
service_args = []
|
68
|
-
service_args << "–host=#{args[:host]}" if args.key? :host
|
69
|
-
service_args << "–package=#{args[:package]}" if args.key? :package
|
70
|
-
service_args << "-verbose" if args[:verbose] == true
|
71
|
-
service_args
|
72
|
-
end
|
73
|
-
end # Bridge
|
74
|
-
end # Edge
|
75
|
-
end # WebDriver
|
76
|
-
end # Selenium
|
@@ -1,117 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
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 LegacySupport
|
24
|
-
# These are commands Edge is still using from JSON Wire Protocol
|
25
|
-
%i[executeScript executeAsyncScript submitElement doubleClick
|
26
|
-
mouseDown mouseUp mouseMoveTo click
|
27
|
-
sendKeysToActiveElement getWindowHandles getCurrentWindowHandle
|
28
|
-
getWindowSize setWindowSize getWindowPosition setWindowPosition
|
29
|
-
maximizeWindow getAlertText acceptAlert dismissAlert].each do |cmd|
|
30
|
-
jwp = Remote::Bridge::COMMANDS[cmd]
|
31
|
-
Remote::W3CBridge.command(cmd, jwp.first, jwp.last)
|
32
|
-
end
|
33
|
-
|
34
|
-
def execute_script(script, *args)
|
35
|
-
result = execute :executeScript, {}, {script: script, args: args}
|
36
|
-
unwrap_script_result result
|
37
|
-
end
|
38
|
-
|
39
|
-
def execute_async_script(script, *args)
|
40
|
-
result = execute :executeAsyncScript, {}, {script: script, args: args}
|
41
|
-
unwrap_script_result result
|
42
|
-
end
|
43
|
-
|
44
|
-
def submit_element(element)
|
45
|
-
execute :submitElement, id: element['ELEMENT']
|
46
|
-
end
|
47
|
-
|
48
|
-
def double_click
|
49
|
-
execute :doubleClick
|
50
|
-
end
|
51
|
-
|
52
|
-
def click
|
53
|
-
execute :click, {}, {button: 0}
|
54
|
-
end
|
55
|
-
|
56
|
-
def context_click
|
57
|
-
execute :click, {}, {button: 2}
|
58
|
-
end
|
59
|
-
|
60
|
-
def mouse_down
|
61
|
-
execute :mouseDown
|
62
|
-
end
|
63
|
-
|
64
|
-
def mouse_up
|
65
|
-
execute :mouseUp
|
66
|
-
end
|
67
|
-
|
68
|
-
def mouse_move_to(element, x = nil, y = nil)
|
69
|
-
element_id = element['ELEMENT'] if element
|
70
|
-
params = {element: element_id}
|
71
|
-
|
72
|
-
if x && y
|
73
|
-
params[:xoffset] = x
|
74
|
-
params[:yoffset] = y
|
75
|
-
end
|
76
|
-
|
77
|
-
execute :mouseMoveTo, {}, params
|
78
|
-
end
|
79
|
-
|
80
|
-
def send_keys_to_active_element(key)
|
81
|
-
execute :sendKeysToActiveElement, {}, {value: key}
|
82
|
-
end
|
83
|
-
|
84
|
-
def window_handle
|
85
|
-
execute :getCurrentWindowHandle
|
86
|
-
end
|
87
|
-
|
88
|
-
def window_size(handle = :current)
|
89
|
-
data = execute :getWindowSize, window_handle: handle
|
90
|
-
|
91
|
-
Dimension.new data['width'], data['height']
|
92
|
-
end
|
93
|
-
|
94
|
-
def resize_window(width, height, handle = :current)
|
95
|
-
execute :setWindowSize, {window_handle: handle},
|
96
|
-
{width: width,
|
97
|
-
height: height}
|
98
|
-
end
|
99
|
-
|
100
|
-
def window_position(handle = :current)
|
101
|
-
data = execute :getWindowPosition, window_handle: handle
|
102
|
-
|
103
|
-
Point.new data['x'], data['y']
|
104
|
-
end
|
105
|
-
|
106
|
-
def reposition_window(x, y, handle = :current)
|
107
|
-
execute :setWindowPosition, {window_handle: handle},
|
108
|
-
{x: x, y: y}
|
109
|
-
end
|
110
|
-
|
111
|
-
def maximize_window(handle = :current)
|
112
|
-
execute :maximizeWindow, window_handle: handle
|
113
|
-
end
|
114
|
-
end # LegacySupport
|
115
|
-
end # Edge
|
116
|
-
end # WebDriver
|
117
|
-
end # Selenium
|
@@ -1,186 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
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 Binary
|
25
|
-
NO_FOCUS_LIBRARY_NAME = 'x_ignore_nofocus.so'.freeze
|
26
|
-
NO_FOCUS_LIBRARIES = [
|
27
|
-
["#{WebDriver.root}/selenium/webdriver/firefox/native/linux/amd64/#{NO_FOCUS_LIBRARY_NAME}",
|
28
|
-
"amd64/#{NO_FOCUS_LIBRARY_NAME}"],
|
29
|
-
["#{WebDriver.root}/selenium/webdriver/firefox/native/linux/x86/#{NO_FOCUS_LIBRARY_NAME}",
|
30
|
-
"x86/#{NO_FOCUS_LIBRARY_NAME}"]
|
31
|
-
].freeze
|
32
|
-
|
33
|
-
WAIT_TIMEOUT = 90
|
34
|
-
QUIT_TIMEOUT = 5
|
35
|
-
|
36
|
-
def start_with(profile, profile_path, *args)
|
37
|
-
if Platform.cygwin?
|
38
|
-
profile_path = Platform.cygwin_path(profile_path, windows: true)
|
39
|
-
elsif Platform.windows?
|
40
|
-
profile_path = profile_path.tr('/', '\\')
|
41
|
-
end
|
42
|
-
|
43
|
-
ENV['XRE_CONSOLE_LOG'] = profile.log_file if profile.log_file
|
44
|
-
ENV['XRE_PROFILE_PATH'] = profile_path
|
45
|
-
ENV['MOZ_NO_REMOTE'] = '1' # able to launch multiple instances
|
46
|
-
ENV['MOZ_CRASHREPORTER_DISABLE'] = '1' # disable breakpad
|
47
|
-
ENV['NO_EM_RESTART'] = '1' # prevent the binary from detaching from the console
|
48
|
-
|
49
|
-
if Platform.linux? && (profile.native_events? || profile.load_no_focus_lib?)
|
50
|
-
modify_link_library_path profile_path
|
51
|
-
end
|
52
|
-
|
53
|
-
execute(*args)
|
54
|
-
end
|
55
|
-
|
56
|
-
def quit
|
57
|
-
return unless @process
|
58
|
-
@process.poll_for_exit QUIT_TIMEOUT
|
59
|
-
rescue ChildProcess::TimeoutError
|
60
|
-
# ok, force quit
|
61
|
-
@process.stop QUIT_TIMEOUT
|
62
|
-
end
|
63
|
-
|
64
|
-
def wait
|
65
|
-
return unless @process
|
66
|
-
|
67
|
-
begin
|
68
|
-
@process.poll_for_exit(WAIT_TIMEOUT)
|
69
|
-
rescue ChildProcess::TimeoutError => e
|
70
|
-
@process.stop
|
71
|
-
raise e
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
private
|
76
|
-
|
77
|
-
def execute(*extra_args)
|
78
|
-
args = [self.class.path, '-no-remote'] + extra_args
|
79
|
-
@process = ChildProcess.build(*args)
|
80
|
-
@process.io.inherit! if $DEBUG
|
81
|
-
@process.start
|
82
|
-
end
|
83
|
-
|
84
|
-
def modify_link_library_path(profile_path)
|
85
|
-
paths = []
|
86
|
-
|
87
|
-
NO_FOCUS_LIBRARIES.each do |from, to|
|
88
|
-
dest = File.join(profile_path, to)
|
89
|
-
FileUtils.mkdir_p File.dirname(dest)
|
90
|
-
FileUtils.cp from, dest
|
91
|
-
|
92
|
-
paths << File.expand_path(File.dirname(dest))
|
93
|
-
end
|
94
|
-
|
95
|
-
paths += ENV['LD_LIBRARY_PATH'].to_s.split(File::PATH_SEPARATOR)
|
96
|
-
|
97
|
-
ENV['LD_LIBRARY_PATH'] = paths.uniq.join(File::PATH_SEPARATOR)
|
98
|
-
ENV['LD_PRELOAD'] = NO_FOCUS_LIBRARY_NAME
|
99
|
-
end
|
100
|
-
|
101
|
-
class << self
|
102
|
-
#
|
103
|
-
# @api private
|
104
|
-
#
|
105
|
-
# @see Firefox.path=
|
106
|
-
#
|
107
|
-
|
108
|
-
def path=(path)
|
109
|
-
Platform.assert_executable(path)
|
110
|
-
@path = path
|
111
|
-
end
|
112
|
-
|
113
|
-
def reset_path!
|
114
|
-
@path = nil
|
115
|
-
end
|
116
|
-
|
117
|
-
def path
|
118
|
-
@path ||= case Platform.os
|
119
|
-
when :macosx
|
120
|
-
macosx_path
|
121
|
-
when :windows
|
122
|
-
windows_path
|
123
|
-
when :linux, :unix
|
124
|
-
Platform.find_binary('firefox3', 'firefox2', 'firefox') || '/usr/bin/firefox'
|
125
|
-
else
|
126
|
-
raise Error::WebDriverError, "unknown platform: #{Platform.os}"
|
127
|
-
end
|
128
|
-
|
129
|
-
@path = Platform.cygwin_path(@path) if Platform.cygwin?
|
130
|
-
|
131
|
-
unless File.file?(@path.to_s)
|
132
|
-
error = "Could not find Firefox binary (os=#{Platform.os}). "
|
133
|
-
error << "Make sure Firefox is installed or set the path manually with #{self}.path="
|
134
|
-
raise Error::WebDriverError, error
|
135
|
-
end
|
136
|
-
|
137
|
-
@path
|
138
|
-
end
|
139
|
-
|
140
|
-
def version
|
141
|
-
@version = case Platform.os
|
142
|
-
when :macosx
|
143
|
-
`#{path} -v`.strip[/[^\s]*$/][/^\d+/].to_i
|
144
|
-
when :windows
|
145
|
-
`\"#{path}\" -v | more`.strip[/[^\s]*$/][/^\d+/].to_i
|
146
|
-
when :linux
|
147
|
-
`#{path} -v`.strip[/[^\s]*$/][/^\d+/].to_i
|
148
|
-
else
|
149
|
-
0
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
private
|
154
|
-
|
155
|
-
def windows_path
|
156
|
-
windows_registry_path ||
|
157
|
-
Platform.find_in_program_files('\\Mozilla Firefox\\firefox.exe') ||
|
158
|
-
Platform.find_binary('firefox')
|
159
|
-
end
|
160
|
-
|
161
|
-
def macosx_path
|
162
|
-
path = '/Applications/Firefox.app/Contents/MacOS/firefox-bin'
|
163
|
-
path = File.expand_path('~/Applications/Firefox.app/Contents/MacOS/firefox-bin') unless File.exist?(path)
|
164
|
-
path = Platform.find_binary('firefox-bin') unless File.exist?(path)
|
165
|
-
|
166
|
-
path
|
167
|
-
end
|
168
|
-
|
169
|
-
def windows_registry_path
|
170
|
-
require 'win32/registry'
|
171
|
-
|
172
|
-
lm = Win32::Registry::HKEY_LOCAL_MACHINE
|
173
|
-
lm.open('SOFTWARE\\Mozilla\\Mozilla Firefox') do |reg|
|
174
|
-
main = lm.open("SOFTWARE\\Mozilla\\Mozilla Firefox\\#{reg.keys[0]}\\Main")
|
175
|
-
entry = main.find { |key, _type, _data| key =~ /pathtoexe/i }
|
176
|
-
return entry.last if entry
|
177
|
-
end
|
178
|
-
rescue LoadError
|
179
|
-
# older JRuby or IronRuby does not have win32/registry
|
180
|
-
rescue Win32::Registry::Error
|
181
|
-
end
|
182
|
-
end # class << self
|
183
|
-
end # Binary
|
184
|
-
end # Firefox
|
185
|
-
end # WebDriver
|
186
|
-
end # Selenium
|
@@ -1,69 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"frozen": {
|
3
|
-
"app.update.auto": false,
|
4
|
-
"app.update.enabled": false,
|
5
|
-
"browser.displayedE10SNotice": 4,
|
6
|
-
"browser.download.manager.showWhenStarting": false,
|
7
|
-
"browser.EULA.override": true,
|
8
|
-
"browser.EULA.3.accepted": true,
|
9
|
-
"browser.link.open_external": 2,
|
10
|
-
"browser.link.open_newwindow": 2,
|
11
|
-
"browser.offline": false,
|
12
|
-
"browser.reader.detectedFirstArticle": true,
|
13
|
-
"browser.safebrowsing.enabled": false,
|
14
|
-
"browser.safebrowsing.malware.enabled": false,
|
15
|
-
"browser.search.update": false,
|
16
|
-
"browser.selfsupport.url" : "",
|
17
|
-
"browser.sessionstore.resume_from_crash": false,
|
18
|
-
"browser.shell.checkDefaultBrowser": false,
|
19
|
-
"browser.tabs.warnOnClose": false,
|
20
|
-
"browser.tabs.warnOnOpen": false,
|
21
|
-
"datareporting.healthreport.service.enabled": false,
|
22
|
-
"datareporting.healthreport.uploadEnabled": false,
|
23
|
-
"datareporting.healthreport.service.firstRun": false,
|
24
|
-
"datareporting.healthreport.logging.consoleEnabled": false,
|
25
|
-
"datareporting.policy.dataSubmissionEnabled": false,
|
26
|
-
"datareporting.policy.dataSubmissionPolicyAccepted": false,
|
27
|
-
"devtools.errorconsole.enabled": true,
|
28
|
-
"dom.disable_open_during_load": false,
|
29
|
-
"extensions.autoDisableScopes": 10,
|
30
|
-
"extensions.blocklist.enabled": false,
|
31
|
-
"extensions.checkCompatibility.nightly": false,
|
32
|
-
"extensions.logging.enabled": true,
|
33
|
-
"extensions.update.enabled": false,
|
34
|
-
"extensions.update.notifyUser": false,
|
35
|
-
"javascript.enabled": true,
|
36
|
-
"network.manage-offline-status": false,
|
37
|
-
"network.http.phishy-userpass-length": 255,
|
38
|
-
"offline-apps.allow_by_default": true,
|
39
|
-
"prompts.tab_modal.enabled": false,
|
40
|
-
"security.csp.enable": false,
|
41
|
-
"security.fileuri.origin_policy": 3,
|
42
|
-
"security.fileuri.strict_origin_policy": false,
|
43
|
-
"signon.rememberSignons": false,
|
44
|
-
"toolkit.networkmanager.disable": true,
|
45
|
-
"toolkit.telemetry.prompted": 2,
|
46
|
-
"toolkit.telemetry.enabled": false,
|
47
|
-
"toolkit.telemetry.rejected": true,
|
48
|
-
"xpinstall.signatures.required": false,
|
49
|
-
"xpinstall.whitelist.required": false
|
50
|
-
},
|
51
|
-
"mutable": {
|
52
|
-
"browser.dom.window.dump.enabled": true,
|
53
|
-
"browser.laterrun.enabled": false,
|
54
|
-
"browser.newtab.url": "about:blank",
|
55
|
-
"browser.newtabpage.enabled": false,
|
56
|
-
"browser.startup.page": 0,
|
57
|
-
"browser.startup.homepage": "about:blank",
|
58
|
-
"browser.startup.homepage_override.mstone": "ignore",
|
59
|
-
"browser.usedOnWindows10.introURL": "about:blank",
|
60
|
-
"dom.max_chrome_script_run_time": 30,
|
61
|
-
"dom.max_script_run_time": 30,
|
62
|
-
"dom.report_all_js_exceptions": true,
|
63
|
-
"javascript.options.showInConsole": true,
|
64
|
-
"startup.homepage_welcome_url": "about:blank",
|
65
|
-
"startup.homepage_welcome_url.additional": "about:blank",
|
66
|
-
"webdriver_accept_untrusted_certs": true,
|
67
|
-
"webdriver_assume_untrusted_issuer": true
|
68
|
-
}
|
69
|
-
}
|