selenium-webdriver 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +7 -0
- data/lib/selenium/webdriver.rb +22 -7
- data/lib/selenium/webdriver/chrome/service.rb +3 -4
- data/lib/selenium/webdriver/common.rb +1 -0
- data/lib/selenium/webdriver/common/action_builder.rb +20 -14
- data/lib/selenium/webdriver/common/driver.rb +3 -3
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +1 -1
- data/lib/selenium/webdriver/common/element.rb +5 -9
- data/lib/selenium/webdriver/common/interactions/key_actions.rb +49 -16
- data/lib/selenium/webdriver/common/logger.rb +79 -0
- data/lib/selenium/webdriver/common/port_prober.rb +1 -1
- data/lib/selenium/webdriver/common/search_context.rb +7 -8
- data/lib/selenium/webdriver/common/socket_lock.rb +1 -1
- data/lib/selenium/webdriver/common/socket_poller.rb +1 -1
- data/lib/selenium/webdriver/edge/service.rb +2 -3
- data/lib/selenium/webdriver/firefox/binary.rb +1 -1
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/profile.rb +1 -1
- data/lib/selenium/webdriver/firefox/service.rb +2 -20
- data/lib/selenium/webdriver/ie/service.rb +2 -3
- data/lib/selenium/webdriver/phantomjs/service.rb +1 -18
- data/lib/selenium/webdriver/remote/bridge.rb +2 -6
- data/lib/selenium/webdriver/remote/http/common.rb +3 -5
- data/lib/selenium/webdriver/remote/http/curb.rb +1 -1
- data/lib/selenium/webdriver/remote/w3c_bridge.rb +7 -6
- data/lib/selenium/webdriver/safari/service.rb +2 -3
- data/selenium-webdriver.gemspec +2 -2
- metadata +5 -4
data/CHANGES
CHANGED
data/lib/selenium/webdriver.rb
CHANGED
@@ -50,15 +50,20 @@ module Selenium
|
|
50
50
|
#
|
51
51
|
# Create a new Driver instance with the correct bridge for the given browser
|
52
52
|
#
|
53
|
-
# @
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
53
|
+
# @overload for(browser)
|
54
|
+
# @param [:ie, :internet_explorer, :edge, :remote, :chrome, :firefox, :ff, :phantomjs, :safari] browser The browser to
|
55
|
+
# create the driver for
|
56
|
+
# @overload for(browser, opts)
|
57
|
+
# @param [:ie, :internet_explorer, :edge, :remote, :chrome, :firefox, :ff, :phantomjs, :safari] browser The browser to
|
58
|
+
# create the driver for
|
59
|
+
# @param [Hash] opts Options passed to Bridge.new
|
57
60
|
#
|
58
61
|
# @return [Driver]
|
59
62
|
#
|
60
63
|
# @see Selenium::WebDriver::Remote::Bridge
|
64
|
+
# @see Selenium::WebDriver::Remote::W3CBridge
|
61
65
|
# @see Selenium::WebDriver::Firefox::Bridge
|
66
|
+
# @see Selenium::WebDriver::Firefox::W3CBridge
|
62
67
|
# @see Selenium::WebDriver::IE::Bridge
|
63
68
|
# @see Selenium::WebDriver::Edge::Bridge
|
64
69
|
# @see Selenium::WebDriver::Chrome::Bridge
|
@@ -67,9 +72,9 @@ module Selenium
|
|
67
72
|
#
|
68
73
|
# @example
|
69
74
|
#
|
70
|
-
# WebDriver.for :firefox, :
|
71
|
-
# WebDriver.for :firefox, :
|
72
|
-
# WebDriver.for :remote, :
|
75
|
+
# WebDriver.for :firefox, profile: 'some-profile'
|
76
|
+
# WebDriver.for :firefox, profile: Profile.new
|
77
|
+
# WebDriver.for :remote, url: "http://localhost:4444/wd/hub", desired_capabilities: caps
|
73
78
|
#
|
74
79
|
# One special argument is not passed on to the bridges, :listener.
|
75
80
|
# You can pass a listener for this option to get notified of WebDriver events.
|
@@ -81,5 +86,15 @@ module Selenium
|
|
81
86
|
def self.for(*args)
|
82
87
|
WebDriver::Driver.for(*args)
|
83
88
|
end
|
89
|
+
|
90
|
+
#
|
91
|
+
# Returns logger instance that can be used across the whole Selenium.
|
92
|
+
#
|
93
|
+
# @return [Logger]
|
94
|
+
#
|
95
|
+
|
96
|
+
def self.logger
|
97
|
+
@logger ||= WebDriver::Logger.new
|
98
|
+
end
|
84
99
|
end # WebDriver
|
85
100
|
end # Selenium
|
@@ -37,10 +37,9 @@ module Selenium
|
|
37
37
|
|
38
38
|
def start_process
|
39
39
|
server_command = [@executable_path, "--port=#{@port}", *@extra_args]
|
40
|
-
@process
|
41
|
-
|
42
|
-
@process.
|
43
|
-
@process.leader = true
|
40
|
+
@process = ChildProcess.build(*server_command)
|
41
|
+
@process.io.stdout = @process.io.stderr = WebDriver.logger.io
|
42
|
+
@process.leader = true unless Platform.windows?
|
44
43
|
@process.start
|
45
44
|
end
|
46
45
|
|
@@ -37,6 +37,7 @@ require 'selenium/webdriver/common/target_locator'
|
|
37
37
|
require 'selenium/webdriver/common/navigation'
|
38
38
|
require 'selenium/webdriver/common/timeouts'
|
39
39
|
require 'selenium/webdriver/common/window'
|
40
|
+
require 'selenium/webdriver/common/logger'
|
40
41
|
require 'selenium/webdriver/common/logs'
|
41
42
|
require 'selenium/webdriver/common/options'
|
42
43
|
require 'selenium/webdriver/common/w3c_options'
|
@@ -69,11 +69,13 @@ module Selenium
|
|
69
69
|
# el = driver.find_element(id: "some_id")
|
70
70
|
# driver.action.key_down(el, :shift).perform
|
71
71
|
#
|
72
|
-
# @
|
73
|
-
#
|
72
|
+
# @overload key_down(key)
|
73
|
+
# @param [:shift, :alt, :control, :command, :meta] key The modifier key to press
|
74
|
+
# @overload key_down(element, key)
|
75
|
+
# @param [Element] element An optional element to move to first
|
76
|
+
# @param [:shift, :alt, :control, :command, :meta] key The modifier key to press
|
74
77
|
# @raise [ArgumentError] if the given key is not a modifier
|
75
|
-
# @return [ActionBuilder] A self reference
|
76
|
-
#
|
78
|
+
# @return [ActionBuilder] A self reference
|
77
79
|
|
78
80
|
def key_down(*args)
|
79
81
|
@actions << [:mouse, :click, [args.shift]] if args.first.is_a? Element
|
@@ -95,10 +97,13 @@ module Selenium
|
|
95
97
|
# el = driver.find_element(id: "some_id")
|
96
98
|
# driver.action.key_up(el, :alt).perform
|
97
99
|
#
|
98
|
-
# @
|
99
|
-
#
|
100
|
-
# @
|
101
|
-
#
|
100
|
+
# @overload key_up(key)
|
101
|
+
# @param [:shift, :alt, :control, :command, :meta] key The modifier key to release
|
102
|
+
# @overload key_up(element, key)
|
103
|
+
# @param [Element] element An optional element to move to first
|
104
|
+
# @param [:shift, :alt, :control, :command, :meta] key The modifier key to release
|
105
|
+
# @raise [ArgumentError] if the given key is not a modifier
|
106
|
+
# @return [ActionBuilder] A self reference
|
102
107
|
#
|
103
108
|
|
104
109
|
def key_up(*args)
|
@@ -124,9 +129,12 @@ module Selenium
|
|
124
129
|
#
|
125
130
|
# driver.action.send_keys("help").perform
|
126
131
|
#
|
127
|
-
# @
|
128
|
-
#
|
129
|
-
# @
|
132
|
+
# @overload send_keys(keys)
|
133
|
+
# @param [Array, Symbol, String] keys The key(s) to press and release
|
134
|
+
# @overload send_keys(element, keys)
|
135
|
+
# @param [Element] element An optional element to move to first
|
136
|
+
# @param [Array, Symbol, String] keys The key(s) to press and release
|
137
|
+
# @return [ActionBuilder] A self reference
|
130
138
|
#
|
131
139
|
|
132
140
|
def send_keys(*args)
|
@@ -147,7 +155,7 @@ module Selenium
|
|
147
155
|
# el = driver.find_element(id: "some_id")
|
148
156
|
# driver.action.click_and_hold(el).perform
|
149
157
|
#
|
150
|
-
# @param [
|
158
|
+
# @param [Element] element the element to move to and click.
|
151
159
|
# @return [ActionBuilder] A self reference.
|
152
160
|
#
|
153
161
|
|
@@ -330,8 +338,6 @@ module Selenium
|
|
330
338
|
# @param [Selenium::WebDriver::Element] source Element to emulate button down at.
|
331
339
|
# @param [Integer] right_by horizontal move offset.
|
332
340
|
# @param [Integer] down_by vertical move offset.
|
333
|
-
# @param [Selenium::WebDriver::Element] target Element to move to and release the
|
334
|
-
# mouse at.
|
335
341
|
# @return [ActionBuilder] A self reference.
|
336
342
|
#
|
337
343
|
|
@@ -221,7 +221,7 @@ module Selenium
|
|
221
221
|
#
|
222
222
|
# @param [String] script
|
223
223
|
# JavaScript source to execute
|
224
|
-
# @param [WebDriver::Element,Integer, Float, Boolean, NilClass, String, Array]
|
224
|
+
# @param [WebDriver::Element, Integer, Float, Boolean, NilClass, String, Array] args
|
225
225
|
# Arguments will be available in the given script in the 'arguments' pseudo-array.
|
226
226
|
#
|
227
227
|
# @return [WebDriver::Element,Integer,Float,Boolean,NilClass,String,Array]
|
@@ -241,7 +241,7 @@ module Selenium
|
|
241
241
|
#
|
242
242
|
# @param [String] script
|
243
243
|
# JavaScript source to execute
|
244
|
-
# @param [WebDriver::Element,Integer, Float, Boolean, NilClass, String, Array]
|
244
|
+
# @param [WebDriver::Element,Integer, Float, Boolean, NilClass, String, Array] args
|
245
245
|
# Arguments to the script. May be empty.
|
246
246
|
#
|
247
247
|
# @return [WebDriver::Element,Integer,Float,Boolean,NilClass,String,Array]
|
@@ -274,7 +274,7 @@ module Selenium
|
|
274
274
|
# Get the first element matching the given selector. If given a
|
275
275
|
# String or Symbol, it will be used as the id of the element.
|
276
276
|
#
|
277
|
-
# @param [String,Hash] id or selector
|
277
|
+
# @param [String,Hash] sel id or selector
|
278
278
|
# @return [WebDriver::Element]
|
279
279
|
#
|
280
280
|
# Examples:
|
@@ -108,10 +108,8 @@ module Selenium
|
|
108
108
|
#
|
109
109
|
# class, readonly
|
110
110
|
#
|
111
|
-
# @param [String]
|
112
|
-
#
|
113
|
-
# @return [String,nil]
|
114
|
-
# attribute value
|
111
|
+
# @param [String] name attribute name
|
112
|
+
# @return [String, nil] attribute value
|
115
113
|
#
|
116
114
|
|
117
115
|
def attribute(name)
|
@@ -122,10 +120,8 @@ module Selenium
|
|
122
120
|
# Get the value of a the given property with the same name of the element. If the value is not
|
123
121
|
# set, nil is returned.
|
124
122
|
#
|
125
|
-
# @param [String]
|
126
|
-
#
|
127
|
-
# @return [String,nil]
|
128
|
-
# property value
|
123
|
+
# @param [String] name property name
|
124
|
+
# @return [String, nil] property value
|
129
125
|
#
|
130
126
|
|
131
127
|
def property(name)
|
@@ -145,7 +141,7 @@ module Selenium
|
|
145
141
|
#
|
146
142
|
# Send keystrokes to this element
|
147
143
|
#
|
148
|
-
# @param [String, Symbol, Array]
|
144
|
+
# @param [String, Symbol, Array] args keystrokes to send
|
149
145
|
#
|
150
146
|
# Examples:
|
151
147
|
#
|
@@ -22,8 +22,8 @@ module Selenium
|
|
22
22
|
module KeyActions
|
23
23
|
#
|
24
24
|
# Performs a key press. Does not release the key - subsequent interactions may assume it's kept pressed.
|
25
|
-
# Note that the
|
26
|
-
# called to release the key.
|
25
|
+
# Note that the key is never released implicitly - either W3CActionBuilder#key_up(key) or W3CActionBuilder#release_actions
|
26
|
+
# must be called to release the key.
|
27
27
|
#
|
28
28
|
# @example Press a key
|
29
29
|
#
|
@@ -34,10 +34,14 @@ module Selenium
|
|
34
34
|
# el = driver.find_element(id: "some_id")
|
35
35
|
# driver.action.key_down(el, :shift).perform
|
36
36
|
#
|
37
|
-
# @
|
38
|
-
#
|
39
|
-
#
|
40
|
-
# @
|
37
|
+
# @overload key_down(key, device: nil)
|
38
|
+
# @param [Symbol, String] key The key to press
|
39
|
+
# @param [Symbol, String] device Optional name of the KeyInput device to press the key on
|
40
|
+
# @overload key_down(element, key, device: nil)
|
41
|
+
# @param [Element] element An optional element to move to first
|
42
|
+
# @param [Symbol, String] key The key to press
|
43
|
+
# @param [Symbol, String] device Optional name of the KeyInput device to press the key on
|
44
|
+
# @return [W3CActionBuilder] A self reference
|
41
45
|
#
|
42
46
|
|
43
47
|
def key_down(*args, device: nil)
|
@@ -45,8 +49,8 @@ module Selenium
|
|
45
49
|
end
|
46
50
|
|
47
51
|
#
|
48
|
-
# Performs a
|
49
|
-
# Releasing a non-depressed
|
52
|
+
# Performs a key release.
|
53
|
+
# Releasing a non-depressed key will yield undefined behaviour.
|
50
54
|
#
|
51
55
|
# @example Release a key
|
52
56
|
#
|
@@ -57,10 +61,14 @@ module Selenium
|
|
57
61
|
# el = driver.find_element(id: "some_id")
|
58
62
|
# driver.action.key_up(el, :alt).perform
|
59
63
|
#
|
60
|
-
# @
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# @
|
64
|
+
# @overload key_up(key, device: nil)
|
65
|
+
# @param [Symbol, String] key The key to press
|
66
|
+
# @param [Symbol, String] device Optional name of the KeyInput device to press the key on
|
67
|
+
# @overload key_up(element, key, device: nil)
|
68
|
+
# @param [Element] element An optional element to move to first
|
69
|
+
# @param [Symbol, String] key The key to release
|
70
|
+
# @param [Symbol, String] device Optional name of the KeyInput device to release the key on
|
71
|
+
# @return [W3CActionBuilder] A self reference
|
64
72
|
#
|
65
73
|
|
66
74
|
def key_up(*args, device: nil)
|
@@ -83,10 +91,14 @@ module Selenium
|
|
83
91
|
#
|
84
92
|
# driver.action.send_keys("help").perform
|
85
93
|
#
|
86
|
-
# @
|
87
|
-
#
|
88
|
-
#
|
89
|
-
# @
|
94
|
+
# @overload send_keys(keys, device: nil)
|
95
|
+
# @param [Array, Symbol, String] keys The key(s) to press and release
|
96
|
+
# @param [Symbol, String] device Optional name of the KeyInput device to press and release the keys on
|
97
|
+
# @overload send_keys(element, keys, device: nil)
|
98
|
+
# @param [Element] element An optional element to move to first
|
99
|
+
# @param [Array, Symbol, String] keys The key(s) to press and release
|
100
|
+
# @param [Symbol, String] device Optional name of the KeyInput device to press and release the keys on
|
101
|
+
# @return [W3CActionBuilder] A self reference
|
90
102
|
#
|
91
103
|
|
92
104
|
def send_keys(*args, device: nil)
|
@@ -100,6 +112,27 @@ module Selenium
|
|
100
112
|
|
101
113
|
private
|
102
114
|
|
115
|
+
#
|
116
|
+
# @api private
|
117
|
+
#
|
118
|
+
# @overload key_down(key, action: nil, device: nil)
|
119
|
+
# @param [Symbol, String] key The key to press
|
120
|
+
# @param [Symbol] action The name of the key action to perform
|
121
|
+
# @param [Symbol, String] device Optional name of the KeyInput device to press the key on
|
122
|
+
# @overload key_down(element, key, action: nil, device: nil)
|
123
|
+
# @param [Element] element An optional element to move to first
|
124
|
+
# @param [Symbol, String] key The key to press
|
125
|
+
# @param [Symbol] action The name of the key action to perform
|
126
|
+
# @param [Symbol, String] device Optional name of the KeyInput device to press the key on
|
127
|
+
#
|
128
|
+
# @param [Array] args
|
129
|
+
# @option args [Element] element An optional element to move to first
|
130
|
+
# @option args [Symbol, String] key The key to perform the action with
|
131
|
+
# @param [Symbol] action The name of the key action to perform
|
132
|
+
# @param [Symbol, String] device optional name of the KeyInput device to press the key on
|
133
|
+
# @return [W3CActionBuilder] A self reference
|
134
|
+
#
|
135
|
+
|
103
136
|
def key_action(*args, action: nil, device: nil)
|
104
137
|
key_input = get_device(device) || key_inputs.first
|
105
138
|
click(args.shift) if args.first.is_a? Element
|
@@ -0,0 +1,79 @@
|
|
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
|
+
require 'forwardable'
|
21
|
+
require 'logger'
|
22
|
+
|
23
|
+
module Selenium
|
24
|
+
module WebDriver
|
25
|
+
#
|
26
|
+
# @example Enable full logging
|
27
|
+
# Selenium::WebDriver.logger.level = :debug
|
28
|
+
#
|
29
|
+
# @example Log to file
|
30
|
+
# Selenium::WebDriver.logger.output = 'selenium.log'
|
31
|
+
#
|
32
|
+
# @example Use logger manually
|
33
|
+
# Selenium::WebDriver.logger.info('This is info message')
|
34
|
+
# Selenium::WebDriver.logger.warn('This is warning message')
|
35
|
+
#
|
36
|
+
class Logger
|
37
|
+
extend Forwardable
|
38
|
+
|
39
|
+
def_delegators :@logger, :debug, :debug?,
|
40
|
+
:info, :info?,
|
41
|
+
:warn, :warn?,
|
42
|
+
:error, :error?,
|
43
|
+
:fatal, :fatal?,
|
44
|
+
:level, :level=
|
45
|
+
|
46
|
+
def initialize
|
47
|
+
@logger = ::Logger.new($stdout)
|
48
|
+
@logger.progname = 'Selenium'
|
49
|
+
@logger.level = ($DEBUG ? :debug : :warn)
|
50
|
+
@logger.formatter = proc do |severity, time, progname, msg|
|
51
|
+
"#{time.strftime('%F %T')} #{severity} #{progname} #{msg}\n"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def output=(io)
|
56
|
+
@logger.reopen(io)
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
60
|
+
# Returns IO object used by logger internally.
|
61
|
+
#
|
62
|
+
# Normally, we would have never needed it, but we want to
|
63
|
+
# use it as IO object for all child processes to ensure their
|
64
|
+
# output is redirected there.
|
65
|
+
#
|
66
|
+
# It is only used in debug level, in other cases output is suppressed.
|
67
|
+
#
|
68
|
+
# @api private
|
69
|
+
#
|
70
|
+
def io
|
71
|
+
if debug?
|
72
|
+
@logger.instance_variable_get(:@logdev).instance_variable_get(:@dev)
|
73
|
+
else
|
74
|
+
File.new(Platform.null_device, 'w')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end # Logger
|
78
|
+
end # WebDriver
|
79
|
+
end # Selenium
|
@@ -47,7 +47,7 @@ module Selenium
|
|
47
47
|
begin
|
48
48
|
TCPServer.new(host, port).close
|
49
49
|
rescue *IGNORED_ERRORS => ex
|
50
|
-
|
50
|
+
WebDriver.logger.info("port prober could not bind to #{host}:#{port} (#{ex.message})")
|
51
51
|
# ignored - some machines appear unable to bind to some of their interfaces
|
52
52
|
end
|
53
53
|
end
|
@@ -35,20 +35,23 @@ module Selenium
|
|
35
35
|
}.freeze
|
36
36
|
|
37
37
|
#
|
38
|
-
# Find the first element matching the given arguments
|
38
|
+
# Find the first element matching the given arguments
|
39
39
|
#
|
40
40
|
# When using Element#find_element with :xpath, be aware that webdriver
|
41
41
|
# follows standard conventions: a search prefixed with "//" will search
|
42
42
|
# the entire document, not just the children of this current node. Use
|
43
43
|
# ".//" to limit your search to the children of the receiving Element.
|
44
44
|
#
|
45
|
-
# @
|
46
|
-
#
|
45
|
+
# @overload find_element(how, what)
|
46
|
+
# @param [Symbol, String] how The method to find the element by
|
47
|
+
# @param [String] what The locator to use
|
48
|
+
# @overload find_element(opts)
|
49
|
+
# @param [Hash] opts Find options
|
50
|
+
# @option opts [Symbol] :how Key named after the method to find the element by, containing the locator
|
47
51
|
# @return [Element]
|
48
52
|
#
|
49
53
|
# @raise [Error::NoSuchElementError] if the element doesn't exist
|
50
54
|
#
|
51
|
-
#
|
52
55
|
|
53
56
|
def find_element(*args)
|
54
57
|
how, what = extract_args(args)
|
@@ -67,10 +70,6 @@ module Selenium
|
|
67
70
|
#
|
68
71
|
# @see SearchContext#find_element
|
69
72
|
#
|
70
|
-
# @param [:class, :class_name, :css, :id, :link_text, :link, :partial_link_text, :name, :tag_name, :xpath] how
|
71
|
-
# @param [String] what
|
72
|
-
# @return [Array<Element>]
|
73
|
-
#
|
74
73
|
|
75
74
|
def find_elements(*args)
|
76
75
|
how, what = extract_args(args)
|
@@ -37,9 +37,8 @@ module Selenium
|
|
37
37
|
|
38
38
|
def start_process
|
39
39
|
server_command = [@executable_path, "--port=#{@port}", *@extra_args]
|
40
|
-
@process
|
41
|
-
|
42
|
-
@process.io.inherit! if $DEBUG
|
40
|
+
@process = ChildProcess.build(*server_command)
|
41
|
+
@process.io.stdout = @process.io.stderr = WebDriver.logger.io
|
43
42
|
@process.start
|
44
43
|
end
|
45
44
|
|
@@ -77,7 +77,7 @@ module Selenium
|
|
77
77
|
def execute(*extra_args)
|
78
78
|
args = [self.class.path, '-no-remote'] + extra_args
|
79
79
|
@process = ChildProcess.build(*args)
|
80
|
-
@process.io.
|
80
|
+
@process.io.stdout = @process.io.stderr = WebDriver.logger.io
|
81
81
|
@process.start
|
82
82
|
end
|
83
83
|
|
Binary file
|
@@ -214,7 +214,7 @@ module Selenium
|
|
214
214
|
destination = File.join(directory, 'extensions')
|
215
215
|
|
216
216
|
@extensions.each do |name, extension|
|
217
|
-
|
217
|
+
WebDriver.logger.info({extenstion: name}.inspect)
|
218
218
|
extension.write_to(destination)
|
219
219
|
end
|
220
220
|
end
|
@@ -41,29 +41,11 @@ module Selenium
|
|
41
41
|
|
42
42
|
def start_process
|
43
43
|
server_command = [@executable_path, "--binary=#{Firefox::Binary.path}", "--port=#{@port}", *@extra_args]
|
44
|
-
@process
|
45
|
-
|
46
|
-
if $DEBUG
|
47
|
-
@process.io.inherit!
|
48
|
-
elsif Platform.windows?
|
49
|
-
# workaround stdio inheritance issue
|
50
|
-
# https://github.com/mozilla/geckodriver/issues/48
|
51
|
-
@process.io.stdout = @process.io.stderr = File.new(Platform.null_device, 'w')
|
52
|
-
end
|
53
|
-
|
44
|
+
@process = ChildProcess.build(*server_command)
|
45
|
+
@process.io.stdout = @process.io.stderr = WebDriver.logger.io
|
54
46
|
@process.start
|
55
47
|
end
|
56
48
|
|
57
|
-
def stop_process
|
58
|
-
super
|
59
|
-
return unless Platform.windows? && !$DEBUG
|
60
|
-
begin
|
61
|
-
@process.io.close
|
62
|
-
rescue
|
63
|
-
nil
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
49
|
def cannot_connect_error_text
|
68
50
|
"unable to connect to Mozilla geckodriver #{@host}:#{@port}"
|
69
51
|
end
|
@@ -37,9 +37,8 @@ module Selenium
|
|
37
37
|
|
38
38
|
def start_process
|
39
39
|
server_command = [@executable_path, "--port=#{@port}", *@extra_args]
|
40
|
-
@process
|
41
|
-
|
42
|
-
@process.io.inherit! if $DEBUG
|
40
|
+
@process = ChildProcess.new(*server_command)
|
41
|
+
@process.io.stdout = @process.io.stderr = WebDriver.logger.io
|
43
42
|
@process.start
|
44
43
|
end
|
45
44
|
|
@@ -34,27 +34,10 @@ module Selenium
|
|
34
34
|
def start_process
|
35
35
|
server_command = [@executable_path, "--webdriver=#{@port}", *@extra_args]
|
36
36
|
@process = ChildProcess.build(*server_command.compact)
|
37
|
-
|
38
|
-
if $DEBUG
|
39
|
-
@process.io.inherit!
|
40
|
-
elsif Platform.jruby?
|
41
|
-
# apparently we need to read the output for phantomjs to work on jruby
|
42
|
-
@process.io.stdout = @process.io.stderr = File.new(Platform.null_device, 'w')
|
43
|
-
end
|
44
|
-
|
37
|
+
@process.io.stdout = @process.io.stderr = WebDriver.logger.io
|
45
38
|
@process.start
|
46
39
|
end
|
47
40
|
|
48
|
-
def stop_process
|
49
|
-
super
|
50
|
-
return unless Platform.jruby? && !$DEBUG
|
51
|
-
begin
|
52
|
-
@process.io.close
|
53
|
-
rescue
|
54
|
-
nil
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
41
|
def cannot_connect_error_text
|
59
42
|
"unable to connect to phantomjs @ #{uri} after #{START_TIMEOUT} seconds"
|
60
43
|
end
|
@@ -33,11 +33,7 @@ module Selenium
|
|
33
33
|
attr_reader :capabilities
|
34
34
|
|
35
35
|
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
# @param url [String] url for the remote server
|
39
|
-
# @param http_client [Object] an HTTP client instance that implements the same protocol as Http::Default
|
40
|
-
# @param desired_capabilities [Capabilities] an instance of Remote::Capabilities describing the capabilities you want
|
36
|
+
# @see W3CBridge#Initialize
|
41
37
|
#
|
42
38
|
|
43
39
|
def initialize(opts = {})
|
@@ -665,7 +661,7 @@ module Selenium
|
|
665
661
|
raise ArgumentError, "#{opts.inspect} invalid for #{command.inspect}"
|
666
662
|
end
|
667
663
|
|
668
|
-
|
664
|
+
WebDriver.logger.info("-> #{verb.to_s.upcase} #{path}")
|
669
665
|
http.call verb, path, command_hash
|
670
666
|
end
|
671
667
|
|
@@ -51,10 +51,8 @@ module Selenium
|
|
51
51
|
headers['Content-Type'] = "#{CONTENT_TYPE}; charset=utf-8"
|
52
52
|
headers['Content-Length'] = payload.bytesize.to_s if [:post, :put].include?(verb)
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
puts " > #{headers.inspect}"
|
57
|
-
end
|
54
|
+
WebDriver.logger.info(" >>> #{url} | #{payload}")
|
55
|
+
WebDriver.logger.info(" > #{headers.inspect}")
|
58
56
|
elsif verb == :post
|
59
57
|
payload = '{}'
|
60
58
|
headers['Content-Length'] = '2'
|
@@ -78,7 +76,7 @@ module Selenium
|
|
78
76
|
code = code.to_i
|
79
77
|
body = body.to_s.strip
|
80
78
|
content_type = content_type.to_s
|
81
|
-
|
79
|
+
WebDriver.logger.info("<- #{body}")
|
82
80
|
|
83
81
|
if content_type.include? CONTENT_TYPE
|
84
82
|
raise Error::WebDriverError, "empty body: #{content_type.inspect} (#{code})\n#{body}" if body.empty?
|
@@ -36,11 +36,12 @@ module Selenium
|
|
36
36
|
attr_reader :capabilities
|
37
37
|
|
38
38
|
#
|
39
|
-
# Initializes the bridge with the given server URL
|
40
|
-
#
|
41
|
-
# @
|
42
|
-
# @
|
43
|
-
# @
|
39
|
+
# Initializes the bridge with the given server URL
|
40
|
+
# @param [Hash] opts options for the driver
|
41
|
+
# @option opts [String] :url url for the remote server
|
42
|
+
# @option opts [Integer] :port port number for the remote server
|
43
|
+
# @option opts [Object] :http_client an HTTP client instance that implements the same protocol as Http::Default
|
44
|
+
# @option opts [Capabilities] :desired_capabilities an instance of Remote::Capabilities describing the capabilities you want
|
44
45
|
#
|
45
46
|
|
46
47
|
def initialize(opts = {})
|
@@ -621,7 +622,7 @@ module Selenium
|
|
621
622
|
raise ArgumentError, "#{opts.inspect} invalid for #{command.inspect}"
|
622
623
|
end
|
623
624
|
|
624
|
-
|
625
|
+
WebDriver.logger.info("-> #{verb.to_s.upcase} #{path}")
|
625
626
|
http.call verb, path, command_hash
|
626
627
|
end
|
627
628
|
|
@@ -47,9 +47,8 @@ module Selenium
|
|
47
47
|
|
48
48
|
def start_process
|
49
49
|
server_command = [@executable_path, "--port=#{@port}", *@extra_args]
|
50
|
-
@process
|
51
|
-
|
52
|
-
@process.io.inherit! if $DEBUG
|
50
|
+
@process = ChildProcess.build(*server_command)
|
51
|
+
@process.io.stdout = @process.io.stderr = WebDriver.logger.io
|
53
52
|
@process.start
|
54
53
|
end
|
55
54
|
|
data/selenium-webdriver.gemspec
CHANGED
@@ -5,7 +5,7 @@ raise "cwd must be #{root} when reading gemspec" if root != Dir.pwd
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'selenium-webdriver'
|
8
|
-
s.version = '3.
|
8
|
+
s.version = '3.2.0'
|
9
9
|
|
10
10
|
s.authors = ['Alex Rodionov', 'Titus Fortner']
|
11
11
|
s.email = ['p0deje@gmail.com', 'titusfortner@gmail.com']
|
@@ -26,7 +26,7 @@ HTML of the application.'
|
|
26
26
|
s.add_runtime_dependency 'childprocess', ['~> 0.5']
|
27
27
|
s.add_runtime_dependency 'websocket', ['~> 1.0']
|
28
28
|
|
29
|
-
s.add_development_dependency 'rspec', ['
|
29
|
+
s.add_development_dependency 'rspec', ['~> 3.0']
|
30
30
|
s.add_development_dependency 'rack', ['~> 1.0']
|
31
31
|
s.add_development_dependency 'ci_reporter', ['~> 1.6', '>= 1.6.2']
|
32
32
|
s.add_development_dependency 'webmock', ['~> 2.0']
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: selenium-webdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 3.
|
5
|
+
version: 3.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Alex Rodionov
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2017-02-
|
14
|
+
date: 2017-02-23 00:00:00 -06:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -53,9 +53,9 @@ dependencies:
|
|
53
53
|
requirement: &id004 !ruby/object:Gem::Requirement
|
54
54
|
none: false
|
55
55
|
requirements:
|
56
|
-
- -
|
56
|
+
- - ~>
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version: "3.
|
58
|
+
version: "3.0"
|
59
59
|
type: :development
|
60
60
|
version_requirements: *id004
|
61
61
|
- !ruby/object:Gem::Dependency
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- lib/selenium/webdriver/common/keyboard.rb
|
152
152
|
- lib/selenium/webdriver/common/keys.rb
|
153
153
|
- lib/selenium/webdriver/common/log_entry.rb
|
154
|
+
- lib/selenium/webdriver/common/logger.rb
|
154
155
|
- lib/selenium/webdriver/common/logs.rb
|
155
156
|
- lib/selenium/webdriver/common/mouse.rb
|
156
157
|
- lib/selenium/webdriver/common/navigation.rb
|