selenium-webdriver 2.52.0 → 2.53.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +14 -0
- data/Gemfile.lock +53 -0
- data/lib/selenium/webdriver.rb +1 -3
- data/lib/selenium/webdriver/chrome/profile.rb +2 -2
- data/lib/selenium/webdriver/chrome/service.rb +8 -5
- data/lib/selenium/webdriver/common.rb +0 -1
- data/lib/selenium/webdriver/common/alert.rb +7 -1
- data/lib/selenium/webdriver/common/element.rb +1 -1
- data/lib/selenium/webdriver/common/error.rb +1 -1
- data/lib/selenium/webdriver/common/platform.rb +8 -0
- data/lib/selenium/webdriver/common/profile_helper.rb +2 -2
- data/lib/selenium/webdriver/common/proxy.rb +1 -1
- data/lib/selenium/webdriver/edge/legacy_support.rb +5 -5
- data/lib/selenium/webdriver/edge/service.rb +8 -5
- data/lib/selenium/webdriver/firefox/binary.rb +4 -0
- data/lib/selenium/webdriver/firefox/extension.rb +13 -11
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/profile.rb +3 -3
- data/lib/selenium/webdriver/firefox/service.rb +8 -5
- data/lib/selenium/webdriver/phantomjs/service.rb +8 -6
- data/lib/selenium/webdriver/remote/bridge.rb +4 -0
- data/lib/selenium/webdriver/remote/capabilities.rb +1 -1
- data/lib/selenium/webdriver/remote/commands.rb +2 -1
- data/lib/selenium/webdriver/remote/http/common.rb +2 -2
- data/lib/selenium/webdriver/remote/w3c_bridge.rb +8 -8
- data/lib/selenium/webdriver/remote/w3c_capabilities.rb +31 -14
- data/lib/selenium/webdriver/remote/w3c_commands.rb +1 -1
- data/lib/selenium/webdriver/safari/resources/client.js +266 -214
- data/lib/selenium/webdriver/safari/server.rb +6 -4
- data/lib/selenium/webdriver/support/select.rb +12 -2
- data/selenium-webdriver.gemspec +1 -2
- metadata +18 -29
- data/lib/selenium/webdriver/common/json_helper.rb +0 -53
data/CHANGES
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
2.53.0 (2016-03-15)
|
2
|
+
===================
|
3
|
+
|
4
|
+
Ruby:
|
5
|
+
* Removed dependency on "multi_json" (issue 1632)
|
6
|
+
* Properly handle namespaces in install manifest of Firefox add-ons (issue 1143)
|
7
|
+
* Improve error handling when stopping browsers (thanks bsedat)
|
8
|
+
* Fix deselecting options in select lists (thanks glib-briia)
|
9
|
+
* Fix w3c error handling
|
10
|
+
* Update w3c Capabilities support
|
11
|
+
|
12
|
+
IE:
|
13
|
+
* support for alert credentials (issue #1698, thanks Alan Baird & trabulmonkee)
|
14
|
+
|
1
15
|
2.52.0 (2016-02-12)
|
2
16
|
===================
|
3
17
|
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
selenium-webdriver (2.53.0dev)
|
5
|
+
childprocess (~> 0.5)
|
6
|
+
rubyzip (~> 1.0)
|
7
|
+
websocket (~> 1.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
addressable (2.4.0)
|
13
|
+
builder (3.2.2)
|
14
|
+
childprocess (0.5.9)
|
15
|
+
ffi (~> 1.0, >= 1.0.11)
|
16
|
+
ci_reporter (1.9.3)
|
17
|
+
builder (>= 2.1.2)
|
18
|
+
crack (0.4.2)
|
19
|
+
safe_yaml (~> 1.0.0)
|
20
|
+
diff-lcs (1.2.5)
|
21
|
+
ffi (1.9.10)
|
22
|
+
hashdiff (0.2.3)
|
23
|
+
rack (1.6.4)
|
24
|
+
rspec (2.99.0)
|
25
|
+
rspec-core (~> 2.99.0)
|
26
|
+
rspec-expectations (~> 2.99.0)
|
27
|
+
rspec-mocks (~> 2.99.0)
|
28
|
+
rspec-core (2.99.2)
|
29
|
+
rspec-expectations (2.99.2)
|
30
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
31
|
+
rspec-mocks (2.99.4)
|
32
|
+
rubyzip (1.2.0)
|
33
|
+
safe_yaml (1.0.4)
|
34
|
+
webmock (1.22.3)
|
35
|
+
addressable (>= 2.3.6)
|
36
|
+
crack (>= 0.3.2)
|
37
|
+
hashdiff
|
38
|
+
websocket (1.2.2)
|
39
|
+
yard (0.8.7.6)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
ruby
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
ci_reporter (~> 1.6, >= 1.6.2)
|
46
|
+
rack (~> 1.0)
|
47
|
+
rspec (~> 2.99.0)
|
48
|
+
selenium-webdriver!
|
49
|
+
webmock (~> 1.7, >= 1.7.5)
|
50
|
+
yard (~> 0.8.7)
|
51
|
+
|
52
|
+
BUNDLED WITH
|
53
|
+
1.11.2
|
data/lib/selenium/webdriver.rb
CHANGED
@@ -21,14 +21,12 @@ require 'childprocess'
|
|
21
21
|
require 'tmpdir'
|
22
22
|
require 'fileutils'
|
23
23
|
require 'date'
|
24
|
+
require 'json'
|
24
25
|
|
25
|
-
require 'multi_json'
|
26
26
|
require 'selenium/webdriver/common'
|
27
27
|
|
28
28
|
module Selenium
|
29
29
|
module WebDriver
|
30
|
-
extend JsonHelper
|
31
|
-
|
32
30
|
Point = Struct.new(:x, :y)
|
33
31
|
Dimension = Struct.new(:width, :height)
|
34
32
|
Location = Struct.new(:latitude, :longitude, :altitude)
|
@@ -87,7 +87,7 @@ module Selenium
|
|
87
87
|
prefs_file = prefs_file_for(dir)
|
88
88
|
|
89
89
|
FileUtils.mkdir_p File.dirname(prefs_file)
|
90
|
-
File.open(prefs_file, "w") { |file| file <<
|
90
|
+
File.open(prefs_file, "w") { |file| file << JSON.generate(prefs) }
|
91
91
|
end
|
92
92
|
|
93
93
|
def prefs
|
@@ -96,7 +96,7 @@ module Selenium
|
|
96
96
|
|
97
97
|
def read_model_prefs
|
98
98
|
return {} unless @model
|
99
|
-
|
99
|
+
JSON.parse File.read(prefs_file_for(@model))
|
100
100
|
end
|
101
101
|
|
102
102
|
def prefs_file_for(dir)
|
@@ -80,11 +80,8 @@ module Selenium
|
|
80
80
|
|
81
81
|
http.get("/shutdown")
|
82
82
|
end
|
83
|
-
|
84
|
-
|
85
|
-
rescue ChildProcess::TimeoutError
|
86
|
-
# ok, force quit
|
87
|
-
@process.stop STOP_TIMEOUT
|
83
|
+
ensure
|
84
|
+
stop_process
|
88
85
|
end
|
89
86
|
|
90
87
|
def uri
|
@@ -105,6 +102,12 @@ module Selenium
|
|
105
102
|
@process.start
|
106
103
|
end
|
107
104
|
|
105
|
+
def stop_process
|
106
|
+
@process.poll_for_exit STOP_TIMEOUT
|
107
|
+
rescue ChildProcess::TimeoutError
|
108
|
+
@process.stop STOP_TIMEOUT
|
109
|
+
end
|
110
|
+
|
108
111
|
def connect_until_stable
|
109
112
|
socket_poller = SocketPoller.new @host, @port, START_TIMEOUT
|
110
113
|
|
@@ -59,6 +59,5 @@ require 'selenium/webdriver/common/driver_extensions/uploads_files'
|
|
59
59
|
require 'selenium/webdriver/common/keys'
|
60
60
|
require 'selenium/webdriver/common/bridge_helper'
|
61
61
|
require 'selenium/webdriver/common/profile_helper'
|
62
|
-
require 'selenium/webdriver/common/json_helper'
|
63
62
|
require 'selenium/webdriver/common/driver'
|
64
63
|
require 'selenium/webdriver/common/element'
|
@@ -43,7 +43,13 @@ module Selenium
|
|
43
43
|
def text
|
44
44
|
@bridge.getAlertText
|
45
45
|
end
|
46
|
+
|
47
|
+
def authenticate(username, password)
|
48
|
+
@bridge.setAuthentication username: username, password: password
|
49
|
+
accept
|
50
|
+
end
|
46
51
|
|
47
52
|
end # Alert
|
48
53
|
end # WebDriver
|
49
|
-
end # Selenium
|
54
|
+
end # Selenium
|
55
|
+
|
@@ -217,7 +217,7 @@ module Selenium
|
|
217
217
|
return Errors[code - 1] if code.is_a? Fixnum
|
218
218
|
|
219
219
|
klass_name = code.split(' ').map(&:capitalize).join
|
220
|
-
Error.const_get("#{klass_name}Error")
|
220
|
+
Error.const_get("#{klass_name.gsub('Error','')}Error")
|
221
221
|
rescue NameError
|
222
222
|
WebDriverError
|
223
223
|
end
|
@@ -38,7 +38,7 @@ module Selenium
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def to_json(*args)
|
41
|
-
|
41
|
+
JSON.generate as_json
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
@@ -65,7 +65,7 @@ module Selenium
|
|
65
65
|
|
66
66
|
module ClassMethods
|
67
67
|
def from_json(json)
|
68
|
-
data =
|
68
|
+
data = JSON.parse(json).fetch('zip')
|
69
69
|
|
70
70
|
# can't use Tempfile here since it doesn't support File::BINARY mode on 1.8
|
71
71
|
# can't use Dir.mktmpdir(&blk) because of http://jira.codehaus.org/browse/JRUBY-4082
|
@@ -24,11 +24,11 @@ module Selenium
|
|
24
24
|
module LegacySupport
|
25
25
|
|
26
26
|
# These are commands Edge is still using from JSON Wire Protocol
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
[:executeScript, :executeAsyncScript, :submitElement, :doubleClick, :mouseDown, :mouseUp, :mouseMoveTo, :click,
|
28
|
+
:sendKeysToActiveElement, :getWindowHandles, :getCurrentWindowHandle, :getWindowSize, :setWindowSize, :getWindowPosition,
|
29
|
+
:setWindowPosition, :maximizeWindow, :getAlertText, :acceptAlert, :dismissAlert].each do |cmd|
|
30
|
+
jwp = Remote::Bridge::COMMANDS[cmd]
|
31
|
+
Remote::W3CBridge.command(cmd, jwp.first, jwp.last)
|
32
32
|
end
|
33
33
|
|
34
34
|
def executeScript(script, *args)
|
@@ -80,11 +80,8 @@ module Selenium
|
|
80
80
|
|
81
81
|
http.head("/shutdown")
|
82
82
|
end
|
83
|
-
|
84
|
-
|
85
|
-
rescue ChildProcess::TimeoutError
|
86
|
-
# ok, force quit
|
87
|
-
@process.stop STOP_TIMEOUT
|
83
|
+
ensure
|
84
|
+
stop_process
|
88
85
|
end
|
89
86
|
|
90
87
|
def uri
|
@@ -103,6 +100,12 @@ module Selenium
|
|
103
100
|
@process.start
|
104
101
|
end
|
105
102
|
|
103
|
+
def stop_process
|
104
|
+
@process.poll_for_exit STOP_TIMEOUT
|
105
|
+
rescue ChildProcess::TimeoutError
|
106
|
+
@process.stop STOP_TIMEOUT
|
107
|
+
end
|
108
|
+
|
106
109
|
def connect_until_stable
|
107
110
|
socket_poller = SocketPoller.new @host, @port, START_TIMEOUT
|
108
111
|
|
@@ -21,8 +21,13 @@ module Selenium
|
|
21
21
|
module WebDriver
|
22
22
|
module Firefox
|
23
23
|
|
24
|
+
#
|
24
25
|
# @api private
|
26
|
+
#
|
27
|
+
|
25
28
|
class Extension
|
29
|
+
NAMESPACE = 'http://www.mozilla.org/2004/em-rdf#'
|
30
|
+
|
26
31
|
def initialize(path)
|
27
32
|
unless File.exist?(path)
|
28
33
|
raise Error::WebDriverError, "could not find extension at #{path.inspect}"
|
@@ -61,20 +66,17 @@ module Selenium
|
|
61
66
|
def read_id_from_install_rdf(directory)
|
62
67
|
rdf_path = File.join(directory, "install.rdf")
|
63
68
|
doc = REXML::Document.new(File.read(rdf_path))
|
69
|
+
namespace = doc.root.namespaces.key(NAMESPACE)
|
64
70
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
id_node.text
|
69
|
-
else
|
70
|
-
attr_node = REXML::XPath.first(doc, "//@em:id")
|
71
|
+
if namespace
|
72
|
+
id_node = REXML::XPath.first(doc, "//#{namespace}:id")
|
73
|
+
return id_node.text if id_node
|
71
74
|
|
72
|
-
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
attr_node.value
|
75
|
+
attr_node = REXML::XPath.first(doc, "//@#{namespace}:id")
|
76
|
+
return attr_node.value if attr_node
|
77
77
|
end
|
78
|
+
|
79
|
+
raise Error::WebDriverError, "cannot locate extension id in #{rdf_path}"
|
78
80
|
end
|
79
81
|
|
80
82
|
end # Extension
|
Binary file
|
@@ -46,7 +46,7 @@ module Selenium
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def default_preferences
|
49
|
-
@default_preferences ||=
|
49
|
+
@default_preferences ||= JSON.parse(
|
50
50
|
File.read(File.expand_path("#{WebDriver.root}/selenium/webdriver/firefox/extension/prefs.json"))
|
51
51
|
).freeze
|
52
52
|
end
|
@@ -261,7 +261,7 @@ module Selenium
|
|
261
261
|
key, value = $1.strip, $2.strip
|
262
262
|
|
263
263
|
# wrap the value in an array to make it a valid JSON string.
|
264
|
-
prefs[key] =
|
264
|
+
prefs[key] = JSON.parse("[#{value}]").first
|
265
265
|
end
|
266
266
|
end
|
267
267
|
|
@@ -271,7 +271,7 @@ module Selenium
|
|
271
271
|
def write_prefs(prefs, path)
|
272
272
|
File.open(path, "w") { |file|
|
273
273
|
prefs.each do |key, value|
|
274
|
-
file.puts %{user_pref("#{key}", #{
|
274
|
+
file.puts %{user_pref("#{key}", #{value.to_json});}
|
275
275
|
end
|
276
276
|
}
|
277
277
|
end
|
@@ -79,11 +79,8 @@ module Selenium
|
|
79
79
|
|
80
80
|
http.head("/shutdown")
|
81
81
|
end
|
82
|
-
|
83
|
-
|
84
|
-
rescue ChildProcess::TimeoutError
|
85
|
-
# ok, force quit
|
86
|
-
@process.stop STOP_TIMEOUT
|
82
|
+
ensure
|
83
|
+
stop_process
|
87
84
|
end
|
88
85
|
|
89
86
|
def uri
|
@@ -102,6 +99,12 @@ module Selenium
|
|
102
99
|
@process.start
|
103
100
|
end
|
104
101
|
|
102
|
+
def stop_process
|
103
|
+
@process.poll_for_exit STOP_TIMEOUT
|
104
|
+
rescue ChildProcess::TimeoutError
|
105
|
+
@process.stop STOP_TIMEOUT
|
106
|
+
end
|
107
|
+
|
105
108
|
def connect_until_stable
|
106
109
|
@socket_poller = SocketPoller.new @host, @port, START_TIMEOUT
|
107
110
|
|
@@ -75,12 +75,8 @@ module Selenium
|
|
75
75
|
|
76
76
|
http.get("/shutdown")
|
77
77
|
end
|
78
|
-
|
79
|
-
|
80
|
-
rescue ChildProcess::TimeoutError
|
81
|
-
# ok, force quit
|
82
|
-
@process.stop STOP_TIMEOUT
|
83
|
-
|
78
|
+
ensure
|
79
|
+
stop_process
|
84
80
|
if Platform.jruby? && !$DEBUG
|
85
81
|
@process.io.close rescue nil
|
86
82
|
end
|
@@ -110,6 +106,12 @@ module Selenium
|
|
110
106
|
@process.start
|
111
107
|
end
|
112
108
|
|
109
|
+
def stop_process
|
110
|
+
@process.poll_for_exit STOP_TIMEOUT
|
111
|
+
rescue ChildProcess::TimeoutError
|
112
|
+
@process.stop STOP_TIMEOUT
|
113
|
+
end
|
114
|
+
|
113
115
|
def connect_until_stable
|
114
116
|
socket_poller = SocketPoller.new @host, @port, START_TIMEOUT
|
115
117
|
|
@@ -77,7 +77,8 @@ class Selenium::WebDriver::Remote::Bridge
|
|
77
77
|
command :acceptAlert, :post, "session/:session_id/accept_alert"
|
78
78
|
command :getAlertText, :get, "session/:session_id/alert_text"
|
79
79
|
command :setAlertValue, :post, "session/:session_id/alert_text"
|
80
|
-
|
80
|
+
command :setAuthentication, :post, "session/:session_id/alert/credentials"
|
81
|
+
|
81
82
|
#
|
82
83
|
# target locator
|
83
84
|
#
|
@@ -43,7 +43,7 @@ module Selenium
|
|
43
43
|
headers['Cache-Control'] = "no-cache" if verb == :get
|
44
44
|
|
45
45
|
if command_hash
|
46
|
-
payload =
|
46
|
+
payload = JSON.generate(command_hash)
|
47
47
|
headers["Content-Type"] = "#{CONTENT_TYPE}; charset=utf-8"
|
48
48
|
headers["Content-Length"] = payload.bytesize.to_s if [:post, :put].include?(verb)
|
49
49
|
|
@@ -75,7 +75,7 @@ module Selenium
|
|
75
75
|
|
76
76
|
if content_type.include? CONTENT_TYPE
|
77
77
|
raise Error::WebDriverError, "empty body: #{content_type.inspect} (#{code})\n#{body}" if body.empty?
|
78
|
-
Response.new(code,
|
78
|
+
Response.new(code, JSON.parse(body))
|
79
79
|
elsif code == 204
|
80
80
|
Response.new(code)
|
81
81
|
else
|