selenium-webdriver 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +8 -0
- data/lib/selenium/server.rb +62 -48
- data/lib/selenium/webdriver/atoms/findElements.js +2 -2
- data/lib/selenium/webdriver/common/profile_helper.rb +1 -7
- data/lib/selenium/webdriver/common/zipper.rb +1 -9
- data/lib/selenium/webdriver/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e567f6423da9f54c6c0a42f36f4dbf08ab8dec0fdad4e82d4091e795a7b3584
|
4
|
+
data.tar.gz: 22b0a89de6793d902c4149bf0b87452680b91dc51df3da86752793c9bfde88ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbc0218b39312e4c1277a544e5ab0cdb735742050827a2f06d60f14c2323c776f5e5e8db0cd7f5e372cfe39e15a6d202daa42bba8bb76ca5ce166522137366a3
|
7
|
+
data.tar.gz: eb0cfd934645fd48a60b4deaddf7ba207a7f26aaa7c1c8d09971fc61ad05b7a096003df367994881e3daaa40c78008a30a52c58c7794903120f3b217017f5b3d
|
data/CHANGES
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
4.0.1 (2021-10-19)
|
2
|
+
=========================
|
3
|
+
|
4
|
+
Server:
|
5
|
+
* Fixed download by pointing to new storage location.
|
6
|
+
- Only supports Selenium 4 versions
|
7
|
+
* Added default value for Server::get and Server::download to use the latest server version
|
8
|
+
|
1
9
|
4.0.0 (2021-10-13)
|
2
10
|
=========================
|
3
11
|
|
data/lib/selenium/server.rb
CHANGED
@@ -57,45 +57,39 @@ module Selenium
|
|
57
57
|
|
58
58
|
CL_RESET = WebDriver::Platform.windows? ? '' : "\r\e[0K"
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
class << self
|
61
|
+
#
|
62
|
+
# Download the given version of the selenium-server jar and return instance
|
63
|
+
#
|
64
|
+
# @param [String, Symbol] required_version X.Y.Z defaults to ':latest'
|
65
|
+
# @param [Hash] opts
|
66
|
+
# @return [Selenium::Server]
|
67
|
+
#
|
63
68
|
|
64
|
-
|
65
|
-
|
66
|
-
|
69
|
+
def get(required_version = :latest, opts = {})
|
70
|
+
new(download(required_version), opts)
|
71
|
+
end
|
67
72
|
|
68
|
-
|
69
|
-
|
73
|
+
#
|
74
|
+
# Download the given version of the selenium-server jar and return location
|
75
|
+
#
|
76
|
+
# @param [String, Symbol] required_version X.Y.Z defaults to ':latest'
|
77
|
+
# @return [String] location of downloaded file
|
78
|
+
#
|
79
|
+
|
80
|
+
def download(required_version = :latest)
|
70
81
|
required_version = latest if required_version == :latest
|
71
|
-
download_file_name = "selenium-server
|
82
|
+
download_file_name = "selenium-server-#{required_version}.jar"
|
72
83
|
|
73
84
|
return download_file_name if File.exist? download_file_name
|
74
85
|
|
75
86
|
begin
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
total = response.content_length
|
80
|
-
progress = 0
|
81
|
-
segment_count = 0
|
82
|
-
|
83
|
-
response.read_body do |segment|
|
84
|
-
progress += segment.length
|
85
|
-
segment_count += 1
|
87
|
+
server = 'https://github.com/seleniumhq/selenium/releases/download'
|
88
|
+
released = Net::HTTP.get_response(URI.parse("#{server}/selenium-#{required_version}/#{download_file_name}"))
|
89
|
+
redirected = URI.parse released.header['location']
|
86
90
|
|
87
|
-
|
88
|
-
|
89
|
-
print "#{CL_RESET}Downloading #{download_file_name}: #{percent.to_i}% (#{progress} / #{total})"
|
90
|
-
segment_count = 0
|
91
|
-
end
|
92
|
-
|
93
|
-
destination.write(segment)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
raise Error, "#{resp.code} for #{download_file_name}" unless resp.is_a? Net::HTTPSuccess
|
98
|
-
end
|
91
|
+
File.open(download_file_name, 'wb') do |destination|
|
92
|
+
download_server(redirected, destination)
|
99
93
|
end
|
100
94
|
rescue StandardError
|
101
95
|
FileUtils.rm download_file_name if File.exist? download_file_name
|
@@ -106,30 +100,57 @@ module Selenium
|
|
106
100
|
end
|
107
101
|
|
108
102
|
#
|
109
|
-
# Ask
|
103
|
+
# Ask GitHub what the latest selenium-server version is.
|
110
104
|
#
|
111
105
|
|
112
106
|
def latest
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
107
|
+
@latest ||= begin
|
108
|
+
net_http_start('api.github.com') do |http|
|
109
|
+
json = http.get('/repos/seleniumhq/selenium/releases').body
|
110
|
+
all_assets = JSON.parse(json).map { |release| release['assets'] }.flatten
|
111
|
+
server_assets = all_assets.map { |asset| asset['name'][/selenium-server-(\d+\.\d+\.\d+)\.jar/, 1] }.compact
|
112
|
+
server_assets.map { |version| Gem::Version.new(version) }.max.version
|
117
113
|
end
|
118
|
-
|
119
|
-
versions.compact.map { |version| Gem::Version.new(version) }.max.version
|
120
114
|
end
|
121
115
|
end
|
122
116
|
|
117
|
+
# @api private
|
118
|
+
|
123
119
|
def net_http_start(address, &block)
|
124
120
|
http_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
|
125
|
-
|
126
121
|
if http_proxy
|
127
122
|
http_proxy = "http://#{http_proxy}" unless http_proxy.start_with?('http://')
|
128
123
|
uri = URI.parse(http_proxy)
|
129
124
|
|
130
125
|
Net::HTTP.start(address, nil, uri.host, uri.port, &block)
|
131
126
|
else
|
132
|
-
Net::HTTP.start(address, &block)
|
127
|
+
Net::HTTP.start(address, use_ssl: true, &block)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def download_server(uri, destination)
|
132
|
+
net_http_start('github-releases.githubusercontent.com') do |http|
|
133
|
+
request = Net::HTTP::Get.new uri
|
134
|
+
resp = http.request(request) do |response|
|
135
|
+
total = response.content_length
|
136
|
+
progress = 0
|
137
|
+
segment_count = 0
|
138
|
+
|
139
|
+
response.read_body do |segment|
|
140
|
+
progress += segment.length
|
141
|
+
segment_count += 1
|
142
|
+
|
143
|
+
if (segment_count % 15).zero?
|
144
|
+
percent = progress.fdiv(total) * 100
|
145
|
+
print "#{CL_RESET}Downloading #{download_file_name}: #{percent.to_i}% (#{progress} / #{total})"
|
146
|
+
segment_count = 0
|
147
|
+
end
|
148
|
+
|
149
|
+
destination.write(segment)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
raise Error, "#{resp.code} for #{download_file_name}" unless resp.is_a? Net::HTTPSuccess
|
133
154
|
end
|
134
155
|
end
|
135
156
|
end
|
@@ -200,10 +221,6 @@ module Selenium
|
|
200
221
|
|
201
222
|
private
|
202
223
|
|
203
|
-
def selenium4?
|
204
|
-
@jar.match?(/[^.]4\./) || @jar.include?('deploy')
|
205
|
-
end
|
206
|
-
|
207
224
|
def stop_process
|
208
225
|
return unless @process.alive?
|
209
226
|
|
@@ -222,10 +239,7 @@ module Selenium
|
|
222
239
|
@process ||= begin
|
223
240
|
# extract any additional_args that start with -D as options
|
224
241
|
properties = @additional_args.dup - @additional_args.delete_if { |arg| arg[/^-D/] }
|
225
|
-
args = ['-jar', @jar]
|
226
|
-
args << @role if selenium4?
|
227
|
-
args << (selenium4? ? '--port' : '-port')
|
228
|
-
args << @port.to_s
|
242
|
+
args = ['-jar', @jar, @role, '--port', @port.to_s]
|
229
243
|
server_command = ['java'] + properties + args + @additional_args
|
230
244
|
cp = ChildProcess.build(*server_command)
|
231
245
|
WebDriver.logger.debug("Executing Process #{server_command}")
|
@@ -108,8 +108,8 @@ function gd(a){var b=a.shape.toLowerCase();a=a.coords.split(",");if("rect"==b&&4
|
|
108
108
|
function hd(a){return a.replace(/^[^\S\xa0]+|[^\S\xa0]+$/g,"")}function id(a){var b=[];Yc?jd(a,b):kd(a,b);a=qa(b,hd);return hd(a.join("\n")).replace(/\xa0/g," ")}
|
109
109
|
function ld(a,b,c){if(S(a,"BR"))b.push("");else{var d=S(a,"TD"),e=V(a,"display"),f=!d&&!(0<=oa(md,e)),g=void 0!==a.previousElementSibling?a.previousElementSibling:gb(a.previousSibling);g=g?V(g,"display"):"";var h=V(a,"float")||V(a,"cssFloat")||V(a,"styleFloat");!f||"run-in"==g&&"none"==h||/^[\s\xa0]*$/.test(b[b.length-1]||"")||b.push("");var n=ed(a),u=null,p=null;n&&(u=V(a,"white-space"),p=V(a,"text-transform"));l(a.childNodes,function(G){c(G,b,n,u,p)});a=b[b.length-1]||"";!d&&"table-cell"!=e||!a||
|
110
110
|
za(a)||(b[b.length-1]+=" ");f&&"run-in"!=e&&!/^[\s\xa0]*$/.test(a)&&b.push("")}}function kd(a,b){ld(a,b,function(c,d,e,f,g){3==c.nodeType&&e?nd(c,d,f,g):S(c)&&kd(c,d)})}var md="inline inline-block inline-table none table-cell table-column table-column-group".split(" ");
|
111
|
-
function nd(a,b,c,d){a=a.nodeValue.replace(/[\u200b\u200e\u200f]/g,"");a=a.replace(/(\r\n|\r|\n)/g,"\n");if("normal"==c||"nowrap"==c)a=a.replace(/\n/g," ");a="pre"==c||"pre-wrap"==c?a.replace(/[ \f\t\v\u2028\u2029]/g,"\u00a0"):a.replace(/[ \f\t\v\u2028\u2029]+/g," ");"capitalize"==d?a=a.replace(/(^|[^\d\p{L}\p{S}])([\p{Ll}|\p{S}])/gu,function(e,f,g){return f+g.toUpperCase()}):"uppercase"==d?a=a.toUpperCase():"lowercase"==d&&(a=a.toLowerCase());c=b.pop()||"";za(c)&&0==a.lastIndexOf(" ",
|
112
|
-
b.push(c+a)}function dd(a){if(Mc){if("relative"==V(a,"position"))return 1;a=V(a,"filter");return(a=a.match(/^alpha\(opacity=(\d*)\)/)||a.match(/^progid:DXImageTransform.Microsoft.Alpha\(Opacity=(\d*)\)/))?Number(a[1])/100:1}return od(a)}function od(a){var b=1,c=V(a,"opacity");c&&(b=Number(c));(a=Zc(a))&&(b*=od(a));return b}
|
111
|
+
function nd(a,b,c,d){a=a.nodeValue.replace(/[\u200b\u200e\u200f]/g,"");a=a.replace(/(\r\n|\r|\n)/g,"\n");if("normal"==c||"nowrap"==c)a=a.replace(/\n/g," ");a="pre"==c||"pre-wrap"==c?a.replace(/[ \f\t\v\u2028\u2029]/g,"\u00a0"):a.replace(/[ \f\t\v\u2028\u2029]+/g," ");"capitalize"==d?a=a.replace(t?/(^|\s|\b)(\S)/g:/(^|[^\d\p{L}\p{S}])([\p{Ll}|\p{S}])/gu,function(e,f,g){return f+g.toUpperCase()}):"uppercase"==d?a=a.toUpperCase():"lowercase"==d&&(a=a.toLowerCase());c=b.pop()||"";za(c)&&0==a.lastIndexOf(" ",
|
112
|
+
0)&&(a=a.substr(1));b.push(c+a)}function dd(a){if(Mc){if("relative"==V(a,"position"))return 1;a=V(a,"filter");return(a=a.match(/^alpha\(opacity=(\d*)\)/)||a.match(/^progid:DXImageTransform.Microsoft.Alpha\(Opacity=(\d*)\)/))?Number(a[1])/100:1}return od(a)}function od(a){var b=1,c=V(a,"opacity");c&&(b=Number(c));(a=Zc(a))&&(b*=od(a));return b}
|
113
113
|
function pd(a,b,c,d,e){if(3==a.nodeType&&c)nd(a,b,d,e);else if(S(a))if(S(a,"CONTENT")||S(a,"SLOT")){for(var f=a;f.parentNode;)f=f.parentNode;f instanceof ShadowRoot?(a=S(a,"CONTENT")?a.getDistributedNodes():a.assignedNodes(),l(a,function(g){pd(g,b,c,d,e)})):jd(a,b)}else if(S(a,"SHADOW")){for(f=a;f.parentNode;)f=f.parentNode;if(f instanceof ShadowRoot&&(a=f))for(a=a.olderShadowRoot;a;)l(a.childNodes,function(g){pd(g,b,c,d,e)}),a=a.olderShadowRoot}else jd(a,b)}
|
114
114
|
function jd(a,b){a.shadowRoot&&l(a.shadowRoot.childNodes,function(c){pd(c,b,!0,null,null)});ld(a,b,function(c,d,e,f,g){var h=null;1==c.nodeType?h=c:3==c.nodeType&&(h=c);null!=h&&(null!=h.assignedSlot||h.getDestinationInsertionPoints&&0<h.getDestinationInsertionPoints().length)||pd(c,d,e,f,g)})};var qd={C:function(a,b){return!(!a.querySelectorAll||!a.querySelector)&&!/^\d.*/.test(b)},o:function(a,b){var c=eb(b),d="string"===typeof a?c.a.getElementById(a):a;return d?Uc(d,"id")==a&&b!=d&&hb(b,d)?d:ua(mb(c,"*"),function(e){return Uc(e,"id")==a&&b!=e&&hb(b,e)}):null},j:function(a,b){if(!a)return[];if(qd.C(b,a))try{return b.querySelectorAll("#"+qd.T(a))}catch(c){return[]}b=mb(eb(b),"*",null,b);return pa(b,function(c){return Uc(c,"id")==a})},T:function(a){return a.replace(/([\s'"\\#.:;,!?+<>=~*^$|%&@`{}\-\/\[\]\(\)])/g,
|
115
115
|
"\\$1")}};var Y={},rd={};Y.N=function(a,b,c){try{var d=Nc.j("a",b)}catch(e){d=mb(eb(b),"A",null,b)}return ua(d,function(e){e=id(e);e=e.replace(/^[\s]+|[\s]+$/g,"");return c&&-1!=e.indexOf(a)||e==a})};Y.K=function(a,b,c){try{var d=Nc.j("a",b)}catch(e){d=mb(eb(b),"A",null,b)}return pa(d,function(e){e=id(e);e=e.replace(/^[\s]+|[\s]+$/g,"");return c&&-1!=e.indexOf(a)||e==a})};Y.o=function(a,b){return Y.N(a,b,!1)};Y.j=function(a,b){return Y.K(a,b,!1)};rd.o=function(a,b){return Y.N(a,b,!0)};
|
@@ -73,16 +73,10 @@ module Selenium
|
|
73
73
|
def from_json(json)
|
74
74
|
data = decoded(json)
|
75
75
|
|
76
|
-
|
77
|
-
# can't use Dir.mktmpdir(&blk) because of http://jira.codehaus.org/browse/JRUBY-4082
|
78
|
-
tmp_dir = Dir.mktmpdir
|
79
|
-
begin
|
80
|
-
zip_path = File.join(tmp_dir, "webdriver-profile-duplicate-#{json.hash}.zip")
|
76
|
+
Tempfile.create do |zip_path|
|
81
77
|
File.open(zip_path, 'wb') { |zip_file| zip_file << Base64.decode64(data) }
|
82
78
|
|
83
79
|
new Zipper.unzip(zip_path)
|
84
|
-
ensure
|
85
|
-
FileUtils.rm_rf tmp_dir
|
86
80
|
end
|
87
81
|
end
|
88
82
|
end # ClassMethods
|
@@ -72,16 +72,8 @@ module Selenium
|
|
72
72
|
private
|
73
73
|
|
74
74
|
def with_tmp_zip(&blk)
|
75
|
-
|
76
|
-
# can't use Dir.mktmpdir(&blk) because of http://jira.codehaus.org/browse/JRUBY-4082
|
77
|
-
tmp_dir = Dir.mktmpdir
|
78
|
-
zip_path = File.join(tmp_dir, 'webdriver-zip')
|
79
|
-
|
80
|
-
begin
|
75
|
+
Tempfile.create do |zip_path|
|
81
76
|
Zip::File.open(zip_path, Zip::File::CREATE, &blk)
|
82
|
-
ensure
|
83
|
-
FileUtils.rm_rf tmp_dir
|
84
|
-
FileUtils.rm_rf zip_path
|
85
77
|
end
|
86
78
|
end
|
87
79
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-webdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Rodionov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-10-
|
13
|
+
date: 2021-10-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: childprocess
|