selenium-webdriver 4.10.0 → 4.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +22 -0
- data/README.md +1 -1
- data/bin/linux/selenium-manager +0 -0
- data/bin/macos/selenium-manager +0 -0
- data/bin/windows/selenium-manager.exe +0 -0
- data/lib/selenium/server.rb +4 -16
- data/lib/selenium/webdriver/atoms/findElements.js +1 -1
- data/lib/selenium/webdriver/atoms/getAttribute.js +1 -1
- data/lib/selenium/webdriver/atoms/isDisplayed.js +1 -1
- data/lib/selenium/webdriver/chrome/driver.rb +2 -2
- data/lib/selenium/webdriver/chrome/service.rb +1 -3
- data/lib/selenium/webdriver/chrome.rb +0 -2
- data/lib/selenium/webdriver/chromium/options.rb +1 -19
- data/lib/selenium/webdriver/chromium.rb +0 -3
- data/lib/selenium/webdriver/common/child_process.rb +2 -2
- data/lib/selenium/webdriver/common/driver.rb +0 -12
- data/lib/selenium/webdriver/common/driver_finder.rb +0 -2
- data/lib/selenium/webdriver/common/local_driver.rb +8 -17
- data/lib/selenium/webdriver/common/options.rb +3 -22
- data/lib/selenium/webdriver/common/platform.rb +0 -49
- data/lib/selenium/webdriver/common/selenium_manager.rb +20 -16
- data/lib/selenium/webdriver/common/service.rb +1 -11
- data/lib/selenium/webdriver/common/websocket_connection.rb +1 -1
- data/lib/selenium/webdriver/edge/driver.rb +2 -2
- data/lib/selenium/webdriver/edge/service.rb +1 -3
- data/lib/selenium/webdriver/edge.rb +0 -2
- data/lib/selenium/webdriver/firefox/driver.rb +2 -2
- data/lib/selenium/webdriver/firefox/options.rb +1 -16
- data/lib/selenium/webdriver/firefox/service.rb +0 -12
- data/lib/selenium/webdriver/ie/driver.rb +2 -2
- data/lib/selenium/webdriver/ie/options.rb +4 -3
- data/lib/selenium/webdriver/ie/service.rb +0 -16
- data/lib/selenium/webdriver/remote/capabilities.rb +0 -72
- data/lib/selenium/webdriver/remote/driver.rb +12 -0
- data/lib/selenium/webdriver/remote/http/default.rb +1 -2
- data/lib/selenium/webdriver/remote/server_error.rb +1 -1
- data/lib/selenium/webdriver/safari/driver.rb +2 -2
- data/lib/selenium/webdriver/version.rb +1 -1
- data/lib/selenium/webdriver.rb +1 -0
- metadata +2 -3
- data/lib/selenium/webdriver/chromium/service.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55168c5bf8486c6fa21e644095be740f2f6db107b6864097e4ee53fdf4568f96
|
4
|
+
data.tar.gz: 276d1d1976e25f0190fdbf3c5745ef20fd8c9693e6602c774a3ad41af0a054c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78c70c53eb450854a115edd260d1e6f796c58f42f795434202868eb025cb0d9e0e06a9268b31c4a7fbb765c25c8a4fabe11ad06a7f6dd3cda25ca0e951c4ba41
|
7
|
+
data.tar.gz: 2efb72b14eb8d51dd8dfe5a4b88a58e9e551194e28ff05f890d208393fc2f34239665e143bddf405b88681c959402527b303a602fc01bfd37b7d12d8dbf29781
|
data/CHANGES
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
4.12.0 (Unreleased)
|
2
|
+
=========================
|
3
|
+
Ruby:
|
4
|
+
* Fix bug preventing good error messages in Selenium Manager when stdout empty
|
5
|
+
* Fix bug with Firefox not loading net/http library by default (#12506)
|
6
|
+
* Remove support for using capabilities in local drivers
|
7
|
+
|
8
|
+
BiDi:
|
9
|
+
* Released selenium-devtools 0.116.0 (supports CDP v85, v114, v115, v116)
|
10
|
+
|
11
|
+
4.11.0 (2023-07-31)
|
12
|
+
=========================
|
13
|
+
Ruby:
|
14
|
+
* Made network interception threads fail silently (#12226)
|
15
|
+
* Have Selenium Manager binary locate drivers on PATH (#12345)
|
16
|
+
* Add browser output from selenium manager to options (#12398)
|
17
|
+
* Remove deprecated code (#12417)
|
18
|
+
BiDi:
|
19
|
+
* Released selenium-devtools 0.115.0 (supports CDP v85, v113, v114, v115)
|
20
|
+
Edge:
|
21
|
+
* Adding ignore process match for IE Mode across bindings (#12279)
|
22
|
+
|
1
23
|
4.10.0 (2023-06-07)
|
2
24
|
=========================
|
3
25
|
Ruby:
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ This gem provides Ruby bindings for Selenium and supports MRI >= 3.0.
|
|
15
15
|
|
16
16
|
## License
|
17
17
|
|
18
|
-
Copyright 2009-
|
18
|
+
Copyright 2009-2023 Software Freedom Conservancy
|
19
19
|
|
20
20
|
Licensed to the Software Freedom Conservancy (SFC) under one
|
21
21
|
or more contributor license agreements. See the NOTICE file
|
data/bin/linux/selenium-manager
CHANGED
Binary file
|
data/bin/macos/selenium-manager
CHANGED
Binary file
|
Binary file
|
data/lib/selenium/server.rb
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
# under the License.
|
19
19
|
|
20
20
|
require 'selenium/webdriver/common/child_process'
|
21
|
+
require 'selenium/webdriver/common/port_prober'
|
21
22
|
require 'selenium/webdriver/common/socket_poller'
|
22
23
|
require 'net/http'
|
23
24
|
|
@@ -165,7 +166,7 @@ module Selenium
|
|
165
166
|
# :standalone, #hub, #node
|
166
167
|
#
|
167
168
|
|
168
|
-
attr_accessor :role, :port, :timeout, :background, :log
|
169
|
+
attr_accessor :role, :host, :port, :timeout, :background, :log
|
169
170
|
|
170
171
|
#
|
171
172
|
# @param [String] jar Path to the server jar.
|
@@ -185,7 +186,7 @@ module Selenium
|
|
185
186
|
@jar = jar
|
186
187
|
@host = '127.0.0.1'
|
187
188
|
@role = opts.fetch(:role, 'standalone')
|
188
|
-
@port = opts.fetch(:port, 4444)
|
189
|
+
@port = opts.fetch(:port, WebDriver::PortProber.above(4444))
|
189
190
|
@timeout = opts.fetch(:timeout, 30)
|
190
191
|
@background = opts.fetch(:background, false)
|
191
192
|
@additional_args = opts.fetch(:args, [])
|
@@ -207,12 +208,6 @@ module Selenium
|
|
207
208
|
end
|
208
209
|
|
209
210
|
def stop
|
210
|
-
begin
|
211
|
-
Net::HTTP.get(@host, '/selenium-server/driver/?cmd=shutDownSeleniumServer', @port)
|
212
|
-
rescue Errno::ECONNREFUSED
|
213
|
-
nil
|
214
|
-
end
|
215
|
-
|
216
211
|
stop_process if @process
|
217
212
|
poll_for_shutdown
|
218
213
|
|
@@ -234,13 +229,7 @@ module Selenium
|
|
234
229
|
private
|
235
230
|
|
236
231
|
def stop_process
|
237
|
-
|
238
|
-
|
239
|
-
begin
|
240
|
-
@process.poll_for_exit(5)
|
241
|
-
rescue WebDriver::ChildProcess::TimeoutError
|
242
|
-
@process.stop
|
243
|
-
end
|
232
|
+
@process.stop
|
244
233
|
rescue Errno::ECHILD
|
245
234
|
# already dead
|
246
235
|
ensure
|
@@ -254,7 +243,6 @@ module Selenium
|
|
254
243
|
args = ['-jar', @jar, @role, '--port', @port.to_s]
|
255
244
|
server_command = ['java'] + properties + args + @additional_args
|
256
245
|
cp = WebDriver::ChildProcess.build(*server_command)
|
257
|
-
WebDriver.logger.debug("Executing Process #{server_command}", id: :server)
|
258
246
|
|
259
247
|
if @log.is_a?(String)
|
260
248
|
cp.io = @log
|
@@ -118,4 +118,4 @@ d=W(d);e=new U(e.a-c,e.b-c,e.width+2*c,e.height+2*c);return e.a<=d.a+d.width&&d.
|
|
118
118
|
}};Z.P={left:Z.V,right:Z.aa,above:Z.R,below:Z.S,near:Z.W};Z.O={left:Z.u,right:Z.u,above:Z.u,below:Z.u,near:Z.u};Z.U=function(a,b){var c=[];l(a,function(e){e&&ta(b,function(f){var g=f.kind,h=Z.P[g];if(!h)throw new P(61,"Cannot find filter suitable for "+g);return h.apply(null,f.args)(e)},null)&&c.push(e)},null);a=b[b.length-1];var d=Z.O[a?a.kind:"unknown"];return d?(a=d.apply(null,a.args))?Z.ba(a,c):c:c};
|
119
119
|
Z.ba=function(a,b){function c(f){f=W(f);return Math.sqrt(Math.pow(d-(f.a+Math.max(1,f.width)/2),2)+Math.pow(e-(f.b+Math.max(1,f.height)/2),2))}a=W(a);var d=a.a+Math.max(1,a.width)/2,e=a.b+Math.max(1,a.height)/2;xa(b,function(f,g){return c(f)-c(g)});return b};Z.o=function(a,b){a=Z.j(a,b);return 0==a.length?null:a[0]};
|
120
120
|
Z.j=function(a,b){if(!a.hasOwnProperty("root")||!a.hasOwnProperty("filters"))throw new P(61,"Locator not suitable for relative locators: "+JSON.stringify(a));var c=a.filters,d=da(c);if("array"!=d&&("object"!=d||"number"!=typeof c.length))throw new P(61,"Targets should be an array: "+JSON.stringify(a));var e;S(a.root)?e=[a.root]:e=ud(a.root,b);return 0==e.length?[]:Z.U(e,a.filters)};var vd={o:function(a,b){if(""===a)throw new P(32,'Unable to locate an element with the tagName ""');return b.getElementsByTagName(a)[0]||null},j:function(a,b){if(""===a)throw new P(32,'Unable to locate an element with the tagName ""');return b.getElementsByTagName(a)}};var td={className:Dc,"class name":Dc,css:Nc,"css selector":Nc,relative:Z,id:qd,linkText:Y,"link text":Y,name:{o:function(a,b){b=mb(eb(b),"*",null,b);return ua(b,function(c){return Uc(c,"name")==a})},j:function(a,b){b=mb(eb(b),"*",null,b);return pa(b,function(c){return Uc(c,"name")==a})}},partialLinkText:rd,"partial link text":rd,tagName:vd,"tag name":vd,xpath:T};function sd(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null}
|
121
|
-
function ud(a,b){var c=sd(a);if(c){var d=td[c];if(d&&ea(d.j))return d.j(a[c],b||Bc.document)}throw new P(61,"Unsupported locator strategy: "+c);};ca("_",ud);; return this._.apply(null,arguments);}).apply(
|
121
|
+
function ud(a,b){var c=sd(a);if(c){var d=td[c];if(d&&ea(d.j))return d.j(a[c],b||Bc.document)}throw new P(61,"Unsupported locator strategy: "+c);};ca("_",ud);; return this._.apply(null,arguments);}).apply(window, arguments);}
|
@@ -97,4 +97,4 @@ Uc.prototype.set=function(a,b){Object.prototype.hasOwnProperty.call(this.b,a)||(
|
|
97
97
|
Z(69,"e","E");Z(70,"f","F");Z(71,"g","G");Z(72,"h","H");Z(73,"i","I");Z(74,"j","J");Z(75,"k","K");Z(76,"l","L");Z(77,"m","M");Z(78,"n","N");Z(79,"o","O");Z(80,"p","P");Z(81,"q","Q");Z(82,"r","R");Z(83,"s","S");Z(84,"t","T");Z(85,"u","U");Z(86,"v","V");Z(87,"w","W");Z(88,"x","X");Z(89,"y","Y");Z(90,"z","Z");var ad=Z(Ia?{g:91,h:91}:Ha?{g:224,h:91}:{g:0,h:91});Z(Ia?{g:92,h:92}:Ha?{g:224,h:93}:{g:0,h:92});Z(Ia?{g:93,h:93}:Ha?{g:0,h:0}:{g:93,h:null});Z({g:96,h:96},"0");Z({g:97,h:97},"1");
|
98
98
|
Z({g:98,h:98},"2");Z({g:99,h:99},"3");Z({g:100,h:100},"4");Z({g:101,h:101},"5");Z({g:102,h:102},"6");Z({g:103,h:103},"7");Z({g:104,h:104},"8");Z({g:105,h:105},"9");Z({g:106,h:106},"*");Z({g:107,h:107},"+");Z({g:109,h:109},"-");Z({g:110,h:110},".");Z({g:111,h:111},"/");Z(144);Z(112);Z(113);Z(114);Z(115);Z(116);Z(117);Z(118);Z(119);Z(120);Z(121);Z(122);Z(123);Z({g:107,h:187},"=","+");Z(108,",");Z({g:109,h:189},"-","_");Z(188,",","<");Z(190,".",">");Z(191,"/","?");Z(192,"`","~");Z(219,"[","{");
|
99
99
|
Z(220,"\\","|");Z(221,"]","}");Z({g:59,h:186},";",":");Z(222,"'",'"');var bd=new Uc;bd.set(1,Yc);bd.set(2,Zc);bd.set(4,$c);bd.set(8,ad);(function(a){var b=new Uc;n(Vc(a),function(c){b.set(a.get(c).code,c)});return b})(bd);var cd={"class":"className",readonly:"readOnly"},dd="allowfullscreen allowpaymentrequest allowusermedia async autofocus autoplay checked compact complete controls declare default defaultchecked defaultselected defer disabled ended formnovalidate hidden indeterminate iscontenteditable ismap itemscope loop multiple muted nohref nomodule noresize noshade novalidate nowrap open paused playsinline pubdate readonly required reversed scoped seamless seeking selected truespeed typemustmatch willvalidate".split(" ");ba("_",function(a,b){var c=null,d=b.toLowerCase();if("style"==d)return(c=a.style)&&!aa(c)&&(c=c.cssText),c;if(("selected"==d||"checked"==d)&&Jc(a)){if(!Jc(a))throw new U(15,"Element is not selectable");b="selected";c=a.type&&a.type.toLowerCase();if("checkbox"==c||"radio"==c)b="checked";return Ic(a,b)?"true":null}var e=Gc(a,"A");if(Gc(a,"IMG")&&"src"==d||e&&"href"==d)return(c=Ec(a,d))&&(c=Ic(a,d)),c;if("spellcheck"==d){c=Ec(a,d);if(null!==c){if("false"==c.toLowerCase())return"false";if("true"==c.toLowerCase())return"true"}return Ic(a,
|
100
|
-
d)+""}e=cd[b]||b;if(0<=ma(dd,d))return(c=null!==Ec(a,b)||Ic(a,e))?"true":null;try{var f=Ic(a,e)}catch(g){}null==f||da(f)?c=Ec(a,b):c=f;return null!=c?c.toString():null});; return this._.apply(null,arguments);}).apply(
|
100
|
+
d)+""}e=cd[b]||b;if(0<=ma(dd,d))return(c=null!==Ec(a,b)||Ic(a,e))?"true":null;try{var f=Ic(a,e)}catch(g){}null==f||da(f)?c=Ec(a,b):c=f;return null!=c?c.toString():null});; return this._.apply(null,arguments);}).apply(window, arguments);}
|
@@ -97,4 +97,4 @@ r.y){var D=Jc(a);if(0==D.width||0==D.height)return Z;var L=e.a<D.a,M=e.b<D.b;if(
|
|
97
97
|
function Jc(a){var b=Lc(a);if(b)return b.rect;if(W(a,"HTML"))return a=A(a),a=((a?a.parentWindow||a.defaultView:window)||window).document,a="CSS1Compat"==a.compatMode?a.documentElement:a.body,a=new Va(a.clientWidth,a.clientHeight),new X(0,0,a.width,a.height);try{var c=a.getBoundingClientRect()}catch(d){return new X(0,0,0,0)}b=new X(c.left,c.top,c.right-c.left,c.bottom-c.top);v&&a.ownerDocument.body&&(a=A(a),b.a-=a.documentElement.clientLeft+a.body.clientLeft,b.b-=a.documentElement.clientTop+a.body.clientTop);
|
98
98
|
return b}function Lc(a){var b=W(a,"MAP");if(!b&&!W(a,"AREA"))return null;var c=b?a:W(a.parentNode,"MAP")?a.parentNode:null,d=null,e=null;c&&c.name&&(d=Dc('/descendant::*[@usemap = "#'+c.name+'"]',A(c)))&&(e=Jc(d),b||"default"==a.shape.toLowerCase()||(a=Oc(a),b=Math.min(Math.max(a.a,0),e.width),c=Math.min(Math.max(a.b,0),e.height),e=new X(b+e.a,c+e.b,Math.min(a.width,e.width-b),Math.min(a.height,e.height-c))));return{image:d,rect:e||new X(0,0,0,0)}}
|
99
99
|
function Oc(a){var b=a.shape.toLowerCase();a=a.coords.split(",");if("rect"==b&&4==a.length){b=a[0];var c=a[1];return new X(b,c,a[2]-b,a[3]-c)}if("circle"==b&&3==a.length)return b=a[2],new X(a[0]-b,a[1]-b,2*b,2*b);if("poly"==b&&2<a.length){b=a[0];c=a[1];for(var d=b,e=c,f=2;f+1<a.length;f+=2)b=Math.min(b,a[f]),d=Math.max(d,a[f]),c=Math.min(c,a[f+1]),e=Math.max(e,a[f+1]);return new X(b,c,d-b,e-c)}return new X(0,0,0,0)}function Nc(a){a=Jc(a);return new Ec(a.b,a.a+a.width,a.b+a.height,a.a)}
|
100
|
-
function Mc(a){if(Ac){if("relative"==Y(a,"position"))return 1;a=Y(a,"filter");return(a=a.match(/^alpha\(opacity=(\d*)\)/)||a.match(/^progid:DXImageTransform.Microsoft.Alpha\(Opacity=(\d*)\)/))?Number(a[1])/100:1}return Pc(a)}function Pc(a){var b=1,c=Y(a,"opacity");c&&(b=Number(c));(a=Gc(a))&&(b*=Pc(a));return b};ba("_",function(a,b){function c(d){if(W(d)&&"none"==Y(d,"display"))return!1;var e;if((e=d.parentNode)&&e.shadowRoot&&void 0!==d.assignedSlot)e=d.assignedSlot?d.assignedSlot.parentNode:null;else if(d.getDestinationInsertionPoints){var f=d.getDestinationInsertionPoints();0<f.length&&(e=f[f.length-1])}if(Fc&&e instanceof ShadowRoot){if(e.host.shadowRoot!==e)return!1;e=e.host}return!e||9!=e.nodeType&&11!=e.nodeType?e&&W(e,"DETAILS")&&!e.open&&!W(d,"SUMMARY")?!1:!!e&&c(e):!0}return Ic(a,!!b,c)});; return this._.apply(null,arguments);}).apply(
|
100
|
+
function Mc(a){if(Ac){if("relative"==Y(a,"position"))return 1;a=Y(a,"filter");return(a=a.match(/^alpha\(opacity=(\d*)\)/)||a.match(/^progid:DXImageTransform.Microsoft.Alpha\(Opacity=(\d*)\)/))?Number(a[1])/100:1}return Pc(a)}function Pc(a){var b=1,c=Y(a,"opacity");c&&(b=Number(c));(a=Gc(a))&&(b*=Pc(a));return b};ba("_",function(a,b){function c(d){if(W(d)&&"none"==Y(d,"display"))return!1;var e;if((e=d.parentNode)&&e.shadowRoot&&void 0!==d.assignedSlot)e=d.assignedSlot?d.assignedSlot.parentNode:null;else if(d.getDestinationInsertionPoints){var f=d.getDestinationInsertionPoints();0<f.length&&(e=f[f.length-1])}if(Fc&&e instanceof ShadowRoot){if(e.host.shadowRoot!==e)return!1;e=e.host}return!e||9!=e.nodeType&&11!=e.nodeType?e&&W(e,"DETAILS")&&!e.open&&!W(d,"SUMMARY")?!1:!!e&&c(e):!0}return Ic(a,!!b,c)});; return this._.apply(null,arguments);}).apply(window, arguments);}
|
@@ -30,8 +30,8 @@ module Selenium
|
|
30
30
|
class Driver < Chromium::Driver
|
31
31
|
include LocalDriver
|
32
32
|
|
33
|
-
def initialize(
|
34
|
-
caps, url = initialize_local_driver(
|
33
|
+
def initialize(options: nil, service: nil, url: nil, **opts)
|
34
|
+
caps, url = initialize_local_driver(options, service, url)
|
35
35
|
super(caps: caps, url: url, **opts)
|
36
36
|
end
|
37
37
|
|
@@ -17,12 +17,10 @@
|
|
17
17
|
# specific language governing permissions and limitations
|
18
18
|
# under the License.
|
19
19
|
|
20
|
-
require 'selenium/webdriver/chromium/service'
|
21
|
-
|
22
20
|
module Selenium
|
23
21
|
module WebDriver
|
24
22
|
module Chrome
|
25
|
-
class Service <
|
23
|
+
class Service < WebDriver::Service
|
26
24
|
DEFAULT_PORT = 9515
|
27
25
|
EXECUTABLE = 'chromedriver'
|
28
26
|
SHUTDOWN_SUPPORTED = true
|
@@ -47,7 +47,7 @@ module Selenium
|
|
47
47
|
#
|
48
48
|
# @example
|
49
49
|
# options = Selenium::WebDriver::Chrome::Options.new(args: ['start-maximized', 'user-data-dir=/tmp/temp_profile'])
|
50
|
-
# driver = Selenium::WebDriver.for(:chrome,
|
50
|
+
# driver = Selenium::WebDriver.for(:chrome, options: options)
|
51
51
|
#
|
52
52
|
# @param [Profile] profile An instance of a Chrome::Profile Class
|
53
53
|
# @param [Hash] opts the pre-defined options to create the Chrome::Options with
|
@@ -159,24 +159,6 @@ module Selenium
|
|
159
159
|
@options[:prefs][name] = value
|
160
160
|
end
|
161
161
|
|
162
|
-
#
|
163
|
-
# Run Chrome in headless mode.
|
164
|
-
# Old headless uses a non-production browser and is set with `--headless`
|
165
|
-
# Native headless from v86 - v108 is set with `--headless=chrome`
|
166
|
-
# Native headless from v109+ is set with `--headless=new`
|
167
|
-
#
|
168
|
-
# @example Enable headless mode
|
169
|
-
# options = Selenium::WebDriver::Chrome::Options.new
|
170
|
-
# options.headless!
|
171
|
-
#
|
172
|
-
|
173
|
-
def headless!
|
174
|
-
WebDriver.logger.deprecate('`Options#headless!`',
|
175
|
-
"`Options#add_argument('--headless=new')`",
|
176
|
-
id: :headless)
|
177
|
-
add_argument '--headless'
|
178
|
-
end
|
179
|
-
|
180
162
|
#
|
181
163
|
# Add emulation device information
|
182
164
|
#
|
@@ -17,8 +17,6 @@
|
|
17
17
|
# specific language governing permissions and limitations
|
18
18
|
# under the License.
|
19
19
|
|
20
|
-
require 'net/http'
|
21
|
-
|
22
20
|
module Selenium
|
23
21
|
module WebDriver
|
24
22
|
module Chromium
|
@@ -26,7 +24,6 @@ module Selenium
|
|
26
24
|
autoload :Driver, 'selenium/webdriver/chromium/driver'
|
27
25
|
autoload :Profile, 'selenium/webdriver/chromium/profile'
|
28
26
|
autoload :Options, 'selenium/webdriver/chromium/options'
|
29
|
-
autoload :Service, 'selenium/webdriver/chromium/service'
|
30
27
|
end # Chromium
|
31
28
|
end # WebDriver
|
32
29
|
end # Selenium
|
@@ -81,11 +81,11 @@ module Selenium
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def exited?
|
84
|
-
return unless @pid
|
84
|
+
return false unless @pid
|
85
85
|
|
86
86
|
WebDriver.logger.debug("Checking if #{@pid} is exited:", id: :process)
|
87
87
|
_, @status = Process.waitpid2(@pid, Process::WNOHANG | Process::WUNTRACED) if @status.nil?
|
88
|
-
return if @status.nil?
|
88
|
+
return false if @status.nil?
|
89
89
|
|
90
90
|
exit_code = @status.exitstatus || @status.termsig
|
91
91
|
WebDriver.logger.debug(" -> exit code is #{exit_code.inspect}", id: :process)
|
@@ -318,18 +318,6 @@ module Selenium
|
|
318
318
|
end
|
319
319
|
end
|
320
320
|
|
321
|
-
def generate_capabilities(capabilities)
|
322
|
-
Array(capabilities).map { |cap|
|
323
|
-
if cap.is_a? Symbol
|
324
|
-
cap = WebDriver::Options.send(cap)
|
325
|
-
elsif !cap.respond_to? :as_json
|
326
|
-
msg = ":capabilities parameter only accepts objects responding to #as_json which #{cap.class} does not"
|
327
|
-
raise ArgumentError, msg
|
328
|
-
end
|
329
|
-
cap.as_json
|
330
|
-
}.inject(:merge)
|
331
|
-
end
|
332
|
-
|
333
321
|
def service_url(service)
|
334
322
|
@service_manager = service.launch
|
335
323
|
@service_manager.uri
|
@@ -23,7 +23,6 @@ module Selenium
|
|
23
23
|
def self.path(options, klass)
|
24
24
|
path = klass.driver_path
|
25
25
|
path = path.call if path.is_a?(Proc)
|
26
|
-
path ||= Platform.find_binary(klass::EXECUTABLE)
|
27
26
|
|
28
27
|
path ||= begin
|
29
28
|
SeleniumManager.driver_path(options) unless options.is_a?(Remote::Capabilities)
|
@@ -32,7 +31,6 @@ module Selenium
|
|
32
31
|
end
|
33
32
|
|
34
33
|
begin
|
35
|
-
Platform.assert_file(path)
|
36
34
|
Platform.assert_executable(path)
|
37
35
|
rescue TypeError
|
38
36
|
raise Error::NoSuchDriverError, "Unable to locate or obtain #{klass::EXECUTABLE}"
|
@@ -20,35 +20,26 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
module LocalDriver
|
23
|
-
def initialize_local_driver(
|
23
|
+
def initialize_local_driver(options, service, url)
|
24
24
|
raise ArgumentError, "Can't initialize #{self.class} with :url" if url
|
25
25
|
|
26
26
|
service ||= Service.send(browser)
|
27
|
-
caps = process_options(options,
|
27
|
+
caps = process_options(options, service)
|
28
28
|
url = service_url(service)
|
29
29
|
|
30
30
|
[caps, url]
|
31
31
|
end
|
32
32
|
|
33
|
-
def process_options(options,
|
33
|
+
def process_options(options, service)
|
34
34
|
default_options = Options.send(browser)
|
35
|
+
options ||= default_options
|
35
36
|
|
36
|
-
|
37
|
-
msg = "Don't use both :options and :capabilities when initializing #{self.class}, prefer :options"
|
38
|
-
raise ArgumentError, msg
|
39
|
-
elsif options && !options.is_a?(default_options.class)
|
37
|
+
unless options.is_a?(default_options.class)
|
40
38
|
raise ArgumentError, ":options must be an instance of #{default_options.class}"
|
41
|
-
elsif capabilities
|
42
|
-
WebDriver.logger.deprecate("The :capabilities parameter for #{self.class}",
|
43
|
-
":options argument with an instance of #{self.class}",
|
44
|
-
id: :capabilities)
|
45
|
-
service.executable_path ||= WebDriver::DriverFinder.path(capabilities, service.class)
|
46
|
-
generate_capabilities(capabilities)
|
47
|
-
else
|
48
|
-
options ||= default_options
|
49
|
-
service.executable_path ||= WebDriver::DriverFinder.path(options, service.class)
|
50
|
-
options.as_json
|
51
39
|
end
|
40
|
+
|
41
|
+
service.executable_path ||= WebDriver::DriverFinder.path(options, service.class)
|
42
|
+
options.as_json
|
52
43
|
end
|
53
44
|
end
|
54
45
|
end
|
@@ -86,12 +86,6 @@ module Selenium
|
|
86
86
|
|
87
87
|
def add_option(name, value = nil)
|
88
88
|
name, value = name.first if value.nil? && name.is_a?(Hash)
|
89
|
-
|
90
|
-
unless name.to_s.include?(':')
|
91
|
-
WebDriver.logger.deprecate('Options#add_option for w3c or browser specific capabilities',
|
92
|
-
'applicable attribute accessors or pass into constructor',
|
93
|
-
id: :add_option)
|
94
|
-
end
|
95
89
|
@options[name] = value
|
96
90
|
end
|
97
91
|
|
@@ -113,24 +107,11 @@ module Selenium
|
|
113
107
|
w3c_options = process_w3c_options(options)
|
114
108
|
|
115
109
|
browser_options = self.class::CAPABILITIES.each_with_object({}) do |(capability_alias, capability_name), hash|
|
116
|
-
|
117
|
-
from_alias = options.delete(capability_alias)
|
118
|
-
capability_value = if !from_name.nil? && capability_alias != capability_name
|
119
|
-
WebDriver.logger.deprecate("#{capability_name} as option",
|
120
|
-
capability_alias.to_s, id: :option_symbols)
|
121
|
-
from_name
|
122
|
-
elsif !from_alias.nil?
|
123
|
-
from_alias
|
124
|
-
end
|
125
|
-
|
110
|
+
capability_value = options.delete(capability_alias)
|
126
111
|
hash[capability_name] = capability_value unless capability_value.nil?
|
127
112
|
end
|
128
113
|
|
129
|
-
unless options.empty?
|
130
|
-
msg = 'These options are not w3c compliant and will result in failures in a future release'
|
131
|
-
WebDriver.logger.warn("#{msg}: #{options}", id: :w3c_options)
|
132
|
-
browser_options.merge!(options)
|
133
|
-
end
|
114
|
+
raise Error::WebDriverError, "These options are not w3c compliant: #{options}" unless options.empty?
|
134
115
|
|
135
116
|
browser_options = {self.class::KEY => browser_options} if defined?(self.class::KEY)
|
136
117
|
|
@@ -145,7 +126,7 @@ module Selenium
|
|
145
126
|
end
|
146
127
|
|
147
128
|
def process_w3c_options(options)
|
148
|
-
w3c_options = options.select { |key,
|
129
|
+
w3c_options = options.select { |key, val| w3c?(key) && !val.nil? }
|
149
130
|
w3c_options[:unhandled_prompt_behavior] &&= w3c_options[:unhandled_prompt_behavior]&.to_s&.tr('_', ' ')
|
150
131
|
options.delete_if { |key, _val| w3c?(key) }
|
151
132
|
w3c_options
|
@@ -62,18 +62,6 @@ module Selenium
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
def bitsize
|
66
|
-
@bitsize ||= if defined?(FFI::Platform::ADDRESS_SIZE)
|
67
|
-
FFI::Platform::ADDRESS_SIZE
|
68
|
-
elsif defined?(FFI)
|
69
|
-
FFI.type_size(:pointer) == 4 ? 32 : 64
|
70
|
-
elsif jruby?
|
71
|
-
Integer(ENV_JAVA['sun.arch.data.model'])
|
72
|
-
else
|
73
|
-
1.size == 4 ? 32 : 64
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
65
|
def jruby?
|
78
66
|
engine == :jruby
|
79
67
|
end
|
@@ -158,43 +146,6 @@ module Selenium
|
|
158
146
|
at_exit { yield if Process.pid == pid }
|
159
147
|
end
|
160
148
|
|
161
|
-
def find_binary(*binary_names)
|
162
|
-
paths = ENV['PATH'].split(File::PATH_SEPARATOR)
|
163
|
-
|
164
|
-
if windows?
|
165
|
-
binary_names.map! { |n| "#{n}.exe" }
|
166
|
-
binary_names.dup.each { |n| binary_names << n.gsub('exe', 'bat') }
|
167
|
-
end
|
168
|
-
|
169
|
-
binary_names.each do |binary_name|
|
170
|
-
paths.each do |path|
|
171
|
-
full_path = File.join(path, binary_name)
|
172
|
-
full_path = unix_path(full_path) if windows?
|
173
|
-
exe = Dir.glob(full_path).find { |f| File.executable?(f) }
|
174
|
-
return exe if exe
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
nil
|
179
|
-
end
|
180
|
-
|
181
|
-
def find_in_program_files(*binary_names)
|
182
|
-
paths = [
|
183
|
-
ENV.fetch('PROGRAMFILES', '\\Program Files'),
|
184
|
-
ENV.fetch('ProgramFiles(x86)', '\\Program Files (x86)'),
|
185
|
-
ENV.fetch('ProgramW6432', '\\Program Files')
|
186
|
-
]
|
187
|
-
|
188
|
-
paths.each do |root|
|
189
|
-
binary_names.each do |name|
|
190
|
-
exe = File.join(root, name)
|
191
|
-
return exe if File.executable?(exe)
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
nil
|
196
|
-
end
|
197
|
-
|
198
149
|
def localhost
|
199
150
|
info = Socket.getaddrinfo 'localhost', 80, Socket::AF_INET, Socket::SOCK_STREAM
|
200
151
|
|
@@ -37,22 +37,26 @@ module Selenium
|
|
37
37
|
# @param [Options] options browser options.
|
38
38
|
# @return [String] the path to the correct driver.
|
39
39
|
def driver_path(options)
|
40
|
-
message = 'applicable driver not found; attempting to install with Selenium Manager (Beta)'
|
41
|
-
WebDriver.logger.debug(message, id: :selenium_manager)
|
42
|
-
|
43
40
|
command = generate_command(binary, options)
|
44
41
|
|
45
|
-
|
46
|
-
|
47
|
-
|
42
|
+
output = run(*command)
|
43
|
+
|
44
|
+
browser_path = output['browser_path']
|
45
|
+
driver_path = output['driver_path']
|
46
|
+
Platform.assert_executable driver_path
|
47
|
+
|
48
|
+
if options.respond_to? :binary
|
49
|
+
options.binary = browser_path
|
50
|
+
options.browser_version = nil
|
51
|
+
end
|
48
52
|
|
49
|
-
|
53
|
+
driver_path
|
50
54
|
end
|
51
55
|
|
52
56
|
private
|
53
57
|
|
54
58
|
def generate_command(binary, options)
|
55
|
-
command = [binary, '--browser', options.browser_name
|
59
|
+
command = [binary, '--browser', options.browser_name]
|
56
60
|
if options.browser_version
|
57
61
|
command << '--browser-version'
|
58
62
|
command << options.browser_version
|
@@ -65,7 +69,6 @@ module Selenium
|
|
65
69
|
command << '--proxy'
|
66
70
|
(command << options.proxy.ssl) || options.proxy.http
|
67
71
|
end
|
68
|
-
command << '--debug' if WebDriver.logger.debug?
|
69
72
|
command
|
70
73
|
end
|
71
74
|
|
@@ -98,26 +101,27 @@ module Selenium
|
|
98
101
|
end
|
99
102
|
|
100
103
|
def run(*command)
|
104
|
+
command += %w[--output json]
|
105
|
+
command << '--debug' if WebDriver.logger.debug?
|
106
|
+
|
101
107
|
WebDriver.logger.debug("Executing Process #{command}", id: :selenium_manager)
|
102
108
|
|
103
109
|
begin
|
104
110
|
stdout, stderr, status = Open3.capture3(*command)
|
105
|
-
json_output = stdout.empty? ? nil : JSON.parse(stdout)
|
106
|
-
result = json_output&.dig('result', 'message')
|
107
111
|
rescue StandardError => e
|
108
112
|
raise Error::WebDriverError, "Unsuccessful command executed: #{command}; #{e.message}"
|
109
113
|
end
|
110
114
|
|
111
|
-
|
115
|
+
json_output = stdout.empty? ? {} : JSON.parse(stdout)
|
116
|
+
(json_output['logs'] || []).each do |log|
|
112
117
|
level = log['level'].casecmp('info').zero? ? 'debug' : log['level'].downcase
|
113
118
|
WebDriver.logger.send(level, log['message'], id: :selenium_manager)
|
114
119
|
end
|
115
120
|
|
116
|
-
|
117
|
-
|
118
|
-
end
|
121
|
+
result = json_output['result']
|
122
|
+
return result unless status.exitstatus.positive?
|
119
123
|
|
120
|
-
result
|
124
|
+
raise Error::WebDriverError, "Unsuccessful command executed: #{command}\n#{result}#{stderr}"
|
121
125
|
end
|
122
126
|
end
|
123
127
|
end # SeleniumManager
|
@@ -81,8 +81,7 @@ module Selenium
|
|
81
81
|
else
|
82
82
|
log
|
83
83
|
end
|
84
|
-
|
85
|
-
@args = args.is_a?(Hash) ? extract_service_args(args) : args
|
84
|
+
@args = args
|
86
85
|
|
87
86
|
raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
|
88
87
|
end
|
@@ -94,15 +93,6 @@ module Selenium
|
|
94
93
|
def shutdown_supported
|
95
94
|
self.class::SHUTDOWN_SUPPORTED
|
96
95
|
end
|
97
|
-
|
98
|
-
protected
|
99
|
-
|
100
|
-
def extract_service_args(driver_opts)
|
101
|
-
WebDriver.logger.deprecate('initializing Service class with :args using Hash',
|
102
|
-
':args parameter with an Array of String values',
|
103
|
-
id: :driver_opts)
|
104
|
-
driver_opts.key?(:args) ? driver_opts.delete(:args) : []
|
105
|
-
end
|
106
96
|
end # Service
|
107
97
|
end # WebDriver
|
108
98
|
end # Selenium
|
@@ -30,8 +30,8 @@ module Selenium
|
|
30
30
|
class Driver < Chromium::Driver
|
31
31
|
include LocalDriver
|
32
32
|
|
33
|
-
def initialize(
|
34
|
-
caps, url = initialize_local_driver(
|
33
|
+
def initialize(options: nil, service: nil, url: nil, **opts)
|
34
|
+
caps, url = initialize_local_driver(options, service, url)
|
35
35
|
super(caps: caps, url: url, **opts)
|
36
36
|
end
|
37
37
|
|
@@ -17,12 +17,10 @@
|
|
17
17
|
# specific language governing permissions and limitations
|
18
18
|
# under the License.
|
19
19
|
|
20
|
-
require 'selenium/webdriver/chromium/service'
|
21
|
-
|
22
20
|
module Selenium
|
23
21
|
module WebDriver
|
24
22
|
module Edge
|
25
|
-
class Service <
|
23
|
+
class Service < WebDriver::Service
|
26
24
|
DEFAULT_PORT = 9515
|
27
25
|
EXECUTABLE = 'msedgedriver'
|
28
26
|
SHUTDOWN_SUPPORTED = true
|
@@ -38,8 +38,8 @@ module Selenium
|
|
38
38
|
|
39
39
|
include LocalDriver
|
40
40
|
|
41
|
-
def initialize(
|
42
|
-
caps, url = initialize_local_driver(
|
41
|
+
def initialize(options: nil, service: nil, url: nil, **opts)
|
42
|
+
caps, url = initialize_local_driver(options, service, url)
|
43
43
|
super(caps: caps, url: url, **opts)
|
44
44
|
end
|
45
45
|
|
@@ -45,7 +45,7 @@ module Selenium
|
|
45
45
|
#
|
46
46
|
# @example
|
47
47
|
# options = Selenium::WebDriver::Firefox::Options.new(args: ['--host=127.0.0.1'])
|
48
|
-
# driver = Selenium::WebDriver.for :firefox,
|
48
|
+
# driver = Selenium::WebDriver.for :firefox, options: options
|
49
49
|
#
|
50
50
|
# @param [Hash] opts the pre-defined options to create the Firefox::Options with
|
51
51
|
# @option opts [String] :binary Path to the Firefox executable to use
|
@@ -99,21 +99,6 @@ module Selenium
|
|
99
99
|
@options[:prefs][name] = value
|
100
100
|
end
|
101
101
|
|
102
|
-
#
|
103
|
-
# Run Firefox in headless mode.
|
104
|
-
#
|
105
|
-
# @example Enable headless mode
|
106
|
-
# options = Selenium::WebDriver::Firefox::Options.new
|
107
|
-
# options.headless!
|
108
|
-
#
|
109
|
-
|
110
|
-
def headless!
|
111
|
-
WebDriver.logger.deprecate('`Options#headless!`',
|
112
|
-
"`Options#add_argument('-headless')`",
|
113
|
-
id: :headless)
|
114
|
-
add_argument '-headless'
|
115
|
-
end
|
116
|
-
|
117
102
|
#
|
118
103
|
# Sets Firefox profile.
|
119
104
|
#
|
@@ -24,18 +24,6 @@ module Selenium
|
|
24
24
|
DEFAULT_PORT = 4444
|
25
25
|
EXECUTABLE = 'geckodriver'
|
26
26
|
SHUTDOWN_SUPPORTED = false
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def extract_service_args(driver_opts)
|
31
|
-
driver_args = super
|
32
|
-
driver_opts = driver_opts.dup
|
33
|
-
driver_args << "--binary=#{driver_opts[:binary]}" if driver_opts.key?(:binary)
|
34
|
-
driver_args << "--log=#{driver_opts[:log]}" if driver_opts.key?(:log)
|
35
|
-
driver_args << "--marionette-port=#{driver_opts[:marionette_port]}" if driver_opts.key?(:marionette_port)
|
36
|
-
driver_args << "--host=#{driver_opts[:host]}" if driver_opts.key?(:host)
|
37
|
-
driver_args
|
38
|
-
end
|
39
27
|
end # Service
|
40
28
|
end # Firefox
|
41
29
|
end # WebDriver
|
@@ -31,8 +31,8 @@ module Selenium
|
|
31
31
|
|
32
32
|
include LocalDriver
|
33
33
|
|
34
|
-
def initialize(
|
35
|
-
caps, url = initialize_local_driver(
|
34
|
+
def initialize(options: nil, service: nil, url: nil, **opts)
|
35
|
+
caps, url = initialize_local_driver(options, service, url)
|
36
36
|
super(caps: caps, url: url, **opts)
|
37
37
|
end
|
38
38
|
|
@@ -41,7 +41,8 @@ module Selenium
|
|
41
41
|
use_per_process_proxy: 'ie.usePerProcessProxy',
|
42
42
|
use_legacy_file_upload_dialog_handling: 'ie.useLegacyFileUploadDialogHandling',
|
43
43
|
attach_to_edge_chrome: 'ie.edgechromium',
|
44
|
-
edge_executable_path: 'ie.edgepath'
|
44
|
+
edge_executable_path: 'ie.edgepath',
|
45
|
+
ignore_process_match: 'ie.ignoreprocessmatch'
|
45
46
|
}.freeze
|
46
47
|
BROWSER = 'internet explorer'
|
47
48
|
|
@@ -52,12 +53,12 @@ module Selenium
|
|
52
53
|
#
|
53
54
|
# @example
|
54
55
|
# options = Selenium::WebDriver::IE::Options.new(args: ['--host=127.0.0.1'])
|
55
|
-
# driver = Selenium::WebDriver.for(:ie,
|
56
|
+
# driver = Selenium::WebDriver.for(:ie, options: options)
|
56
57
|
#
|
57
58
|
# @example
|
58
59
|
# options = Selenium::WebDriver::IE::Options.new
|
59
60
|
# options.element_scroll_behavior = Selenium::WebDriver::IE::Options::SCROLL_BOTTOM
|
60
|
-
# driver = Selenium::WebDriver.for(:ie,
|
61
|
+
# driver = Selenium::WebDriver.for(:ie, options: options)
|
61
62
|
#
|
62
63
|
# @param [Hash] opts the pre-defined options
|
63
64
|
# @option opts [Array<String>] args
|
@@ -24,22 +24,6 @@ module Selenium
|
|
24
24
|
DEFAULT_PORT = 5555
|
25
25
|
EXECUTABLE = 'IEDriverServer'
|
26
26
|
SHUTDOWN_SUPPORTED = true
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def extract_service_args(driver_opts)
|
31
|
-
driver_args = super
|
32
|
-
driver_opts = driver_opts.dup
|
33
|
-
driver_args << "--log-level=#{driver_opts[:log_level].to_s.upcase}" if driver_opts.key?(:log_level)
|
34
|
-
driver_args << "--log-file=#{driver_opts[:log_file]}" if driver_opts.key?(:log_file)
|
35
|
-
if driver_opts.key?(:implementation)
|
36
|
-
driver_args << "--implementation=#{driver_opts[:implementation].to_s.upcase}"
|
37
|
-
end
|
38
|
-
driver_args << "--host=#{driver_opts[:host]}" if driver_opts.key?(:host)
|
39
|
-
driver_args << "--extract_path=#{driver_opts[:extract_path]}" if driver_opts.key?(:extract_path)
|
40
|
-
driver_args << '--silent' if driver_opts[:silent] == true
|
41
|
-
driver_args
|
42
|
-
end
|
43
27
|
end # Server
|
44
28
|
end # IE
|
45
29
|
end # WebDriver
|
@@ -53,83 +53,11 @@ module Selenium
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
#
|
57
|
-
# Backward compatibility
|
58
|
-
#
|
59
|
-
|
60
|
-
def version
|
61
|
-
WebDriver.logger.deprecate('`Capabilities#version`', '`Capabilities#browser_version`', id: :jwp_caps)
|
62
|
-
browser_version
|
63
|
-
end
|
64
|
-
|
65
|
-
def version=(value)
|
66
|
-
WebDriver.logger.deprecate('`Capabilities#version=`', '`Capabilities#browser_version=`', id: :jwp_caps)
|
67
|
-
self.browser_version = value
|
68
|
-
end
|
69
|
-
|
70
|
-
def platform
|
71
|
-
WebDriver.logger.deprecate('`Capabilities#platform`', '`Capabilities#platform_name`', id: :jwp_caps)
|
72
|
-
platform_name
|
73
|
-
end
|
74
|
-
|
75
|
-
def platform=(value)
|
76
|
-
WebDriver.logger.deprecate('`Capabilities#platform=`', '`Capabilities#platform_name=`', id: :jwp_caps)
|
77
|
-
self.platform_name = value
|
78
|
-
end
|
79
|
-
|
80
56
|
#
|
81
57
|
# Convenience methods for the common choices.
|
82
58
|
#
|
83
59
|
|
84
60
|
class << self
|
85
|
-
def chrome(opts = {})
|
86
|
-
WebDriver.logger.deprecate('Remote::Capabilities.chrome', 'Options.chrome', id: :caps_browsers)
|
87
|
-
new({
|
88
|
-
browser_name: 'chrome'
|
89
|
-
}.merge(opts))
|
90
|
-
end
|
91
|
-
|
92
|
-
def edge(opts = {})
|
93
|
-
WebDriver.logger.deprecate('Remote::Capabilities.edge', 'Options.edge', id: :caps_browsers)
|
94
|
-
new({
|
95
|
-
browser_name: 'MicrosoftEdge'
|
96
|
-
}.merge(opts))
|
97
|
-
end
|
98
|
-
alias microsoftedge edge
|
99
|
-
|
100
|
-
def firefox(opts = {})
|
101
|
-
WebDriver.logger.deprecate('Remote::Capabilities.firefox', 'Options.firefox', id: :caps_browsers)
|
102
|
-
new({
|
103
|
-
browser_name: 'firefox'
|
104
|
-
}.merge(opts))
|
105
|
-
end
|
106
|
-
alias ff firefox
|
107
|
-
|
108
|
-
def safari(opts = {})
|
109
|
-
WebDriver.logger.deprecate('Remote::Capabilities.safari', 'Options.safari', id: :caps_browsers)
|
110
|
-
new({
|
111
|
-
browser_name: Selenium::WebDriver::Safari.technology_preview? ? 'Safari Technology Preview' : 'safari'
|
112
|
-
}.merge(opts))
|
113
|
-
end
|
114
|
-
|
115
|
-
def htmlunit(opts = {})
|
116
|
-
WebDriver.logger.deprecate('Remote::Capabilities.htmlunit',
|
117
|
-
'as argument in constructor',
|
118
|
-
id: :caps_browsers)
|
119
|
-
new({
|
120
|
-
browser_name: 'htmlunit'
|
121
|
-
}.merge(opts))
|
122
|
-
end
|
123
|
-
|
124
|
-
def internet_explorer(opts = {})
|
125
|
-
WebDriver.logger.deprecate('Remote::Capabilities.ie', 'Options.ie', id: :caps_browsers)
|
126
|
-
new({
|
127
|
-
browser_name: 'internet explorer',
|
128
|
-
platform_name: :windows
|
129
|
-
}.merge(opts))
|
130
|
-
end
|
131
|
-
alias ie internet_explorer
|
132
|
-
|
133
61
|
def always_match(capabilities)
|
134
62
|
new(always_match: capabilities)
|
135
63
|
end
|
@@ -60,6 +60,18 @@ module Selenium
|
|
60
60
|
end
|
61
61
|
options ? options.as_json : generate_capabilities(capabilities)
|
62
62
|
end
|
63
|
+
|
64
|
+
def generate_capabilities(capabilities)
|
65
|
+
Array(capabilities).map { |cap|
|
66
|
+
if cap.is_a? Symbol
|
67
|
+
cap = WebDriver::Options.send(cap)
|
68
|
+
elsif !cap.respond_to? :as_json
|
69
|
+
msg = ":capabilities parameter only accepts objects responding to #as_json which #{cap.class} does not"
|
70
|
+
raise ArgumentError, msg
|
71
|
+
end
|
72
|
+
cap.as_json
|
73
|
+
}.inject(:merge)
|
74
|
+
end
|
63
75
|
end # Driver
|
64
76
|
end # Remote
|
65
77
|
end # WebDriver
|
@@ -16,8 +16,6 @@
|
|
16
16
|
# KIND, either express or implied. See the License for the
|
17
17
|
# specific language governing permissions and limitations
|
18
18
|
# under the License.
|
19
|
-
|
20
|
-
require 'net/https'
|
21
19
|
require 'ipaddr'
|
22
20
|
|
23
21
|
module Selenium
|
@@ -96,6 +94,7 @@ module Selenium
|
|
96
94
|
end
|
97
95
|
|
98
96
|
if response.is_a? Net::HTTPRedirection
|
97
|
+
WebDriver.logger.debug("Redirect to #{response['Location']}; times: #{redirects}")
|
99
98
|
raise Error::WebDriverError, 'too many redirects' if redirects >= MAX_REDIRECTS
|
100
99
|
|
101
100
|
request(:get, URI.parse(response['Location']), DEFAULT_HEADERS.dup, nil, redirects + 1)
|
@@ -32,8 +32,8 @@ module Selenium
|
|
32
32
|
|
33
33
|
include LocalDriver
|
34
34
|
|
35
|
-
def initialize(
|
36
|
-
caps, url = initialize_local_driver(
|
35
|
+
def initialize(options: nil, service: nil, url: nil, **opts)
|
36
|
+
caps, url = initialize_local_driver(options, service, url)
|
37
37
|
super(caps: caps, url: url, **opts)
|
38
38
|
end
|
39
39
|
|
data/lib/selenium/webdriver.rb
CHANGED
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.
|
4
|
+
version: 4.12.0
|
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: 2023-
|
13
|
+
date: 2023-08-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rexml
|
@@ -242,7 +242,6 @@ files:
|
|
242
242
|
- lib/selenium/webdriver/chromium/features.rb
|
243
243
|
- lib/selenium/webdriver/chromium/options.rb
|
244
244
|
- lib/selenium/webdriver/chromium/profile.rb
|
245
|
-
- lib/selenium/webdriver/chromium/service.rb
|
246
245
|
- lib/selenium/webdriver/common.rb
|
247
246
|
- lib/selenium/webdriver/common/action_builder.rb
|
248
247
|
- lib/selenium/webdriver/common/alert.rb
|
@@ -1,42 +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 Chromium
|
23
|
-
class Service < WebDriver::Service
|
24
|
-
protected
|
25
|
-
|
26
|
-
def extract_service_args(driver_opts)
|
27
|
-
driver_args = super
|
28
|
-
driver_opts = driver_opts.dup
|
29
|
-
driver_args << "--log-path=#{driver_opts.delete(:log_path)}" if driver_opts.key?(:log_path)
|
30
|
-
driver_args << "--url-base=#{driver_opts.delete(:url_base)}" if driver_opts.key?(:url_base)
|
31
|
-
driver_args << "--port-server=#{driver_opts.delete(:port_server)}" if driver_opts.key?(:port_server)
|
32
|
-
if driver_opts.key?(:whitelisted_ips)
|
33
|
-
driver_args << "--whitelisted-ips=#{driver_opts.delete(:whitelisted_ips)}"
|
34
|
-
end
|
35
|
-
driver_args << '--verbose' if driver_opts.key?(:verbose)
|
36
|
-
driver_args << '--silent' if driver_opts.key?(:silent)
|
37
|
-
driver_args
|
38
|
-
end
|
39
|
-
end # Service
|
40
|
-
end # Chromium
|
41
|
-
end # WebDriver
|
42
|
-
end # Selenium
|