selenium-webdriver 4.12.0 → 4.13.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.
- package/CHANGES.md +11 -0
- package/bin/linux/selenium-manager +0 -0
- package/bin/macos/selenium-manager +0 -0
- package/bin/windows/selenium-manager.exe +0 -0
- package/chrome.js +6 -2
- package/chromium.js +8 -4
- package/common/seleniumManager.js +11 -13
- package/firefox.js +3 -3
- package/lib/atoms/find-elements.js +1 -1
- package/lib/atoms/get-attribute.js +1 -1
- package/lib/atoms/is-displayed.js +1 -1
- package/lib/by.js +5 -1
- package/package.json +1 -1
- package/remote/index.js +0 -1
- package/remote/util.js +5 -1
package/CHANGES.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 4.13.0
|
|
2
|
+
|
|
3
|
+
#### :nail_care: Polish
|
|
4
|
+
|
|
5
|
+
* Adding CDP v117 and removing v114
|
|
6
|
+
* Added file location to exception message for Selenium Manager
|
|
7
|
+
|
|
8
|
+
#### :rocket: New Feature
|
|
9
|
+
|
|
10
|
+
* Allow users to set Selenium Manager path by environment variable (#12752)
|
|
11
|
+
|
|
1
12
|
## 4.12.0
|
|
2
13
|
|
|
3
14
|
#### :bug: Bug fix
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/chrome.js
CHANGED
|
@@ -127,7 +127,6 @@
|
|
|
127
127
|
|
|
128
128
|
'use strict'
|
|
129
129
|
|
|
130
|
-
const io = require('./io')
|
|
131
130
|
const { Browser } = require('./lib/capabilities')
|
|
132
131
|
const chromium = require('./chromium')
|
|
133
132
|
const CHROME_CAPABILITY_KEY = 'goog:chromeOptions'
|
|
@@ -221,7 +220,12 @@ class Driver extends chromium.Driver {
|
|
|
221
220
|
static createSession(opt_config, opt_serviceExecutor) {
|
|
222
221
|
let caps = opt_config || new Options()
|
|
223
222
|
return /** @type {!Driver} */ (
|
|
224
|
-
super.createSession(
|
|
223
|
+
super.createSession(
|
|
224
|
+
caps,
|
|
225
|
+
opt_serviceExecutor,
|
|
226
|
+
'goog',
|
|
227
|
+
CHROME_CAPABILITY_KEY
|
|
228
|
+
)
|
|
225
229
|
)
|
|
226
230
|
}
|
|
227
231
|
|
package/chromium.js
CHANGED
|
@@ -679,8 +679,12 @@ class Driver extends webdriver.WebDriver {
|
|
|
679
679
|
* @param vendorCapabilityKey Either 'goog:chromeOptions' or 'ms:edgeOptions'
|
|
680
680
|
* @return {!Driver} A new driver instance.
|
|
681
681
|
*/
|
|
682
|
-
static createSession(
|
|
683
|
-
|
|
682
|
+
static createSession(
|
|
683
|
+
caps,
|
|
684
|
+
opt_serviceExecutor,
|
|
685
|
+
vendorPrefix = '',
|
|
686
|
+
vendorCapabilityKey = ''
|
|
687
|
+
) {
|
|
684
688
|
let executor
|
|
685
689
|
let onQuit
|
|
686
690
|
if (opt_serviceExecutor instanceof http.Executor) {
|
|
@@ -689,14 +693,14 @@ class Driver extends webdriver.WebDriver {
|
|
|
689
693
|
} else {
|
|
690
694
|
let service = opt_serviceExecutor || this.getDefaultService()
|
|
691
695
|
if (!service.getExecutable()) {
|
|
692
|
-
const {driverPath, browserPath} = getPath(caps)
|
|
696
|
+
const { driverPath, browserPath } = getPath(caps)
|
|
693
697
|
service.setExecutable(driverPath)
|
|
694
698
|
const vendorOptions = caps.get(vendorCapabilityKey)
|
|
695
699
|
if (vendorOptions) {
|
|
696
700
|
vendorOptions['binary'] = browserPath
|
|
697
701
|
caps.set(vendorCapabilityKey, vendorOptions)
|
|
698
702
|
} else {
|
|
699
|
-
caps.set(vendorCapabilityKey, {binary: browserPath})
|
|
703
|
+
caps.set(vendorCapabilityKey, { binary: browserPath })
|
|
700
704
|
}
|
|
701
705
|
}
|
|
702
706
|
onQuit = () => service.kill()
|
|
@@ -27,7 +27,7 @@ const fs = require('fs')
|
|
|
27
27
|
const spawnSync = require('child_process').spawnSync
|
|
28
28
|
const { Capability } = require('../lib/capabilities')
|
|
29
29
|
|
|
30
|
-
let debugMessagePrinted = false
|
|
30
|
+
let debugMessagePrinted = false
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Determines the path of the correct Selenium Manager binary
|
|
@@ -46,15 +46,15 @@ function getBinary() {
|
|
|
46
46
|
|
|
47
47
|
let seleniumManagerBasePath = path.join(__dirname, '..', '/bin')
|
|
48
48
|
|
|
49
|
-
const filePath = path.join(seleniumManagerBasePath, directory, file)
|
|
49
|
+
const filePath = process.env.SE_MANAGER_PATH || path.join(seleniumManagerBasePath, directory, file)
|
|
50
50
|
|
|
51
51
|
if (!fs.existsSync(filePath)) {
|
|
52
|
-
throw new Error(`Unable to obtain Selenium Manager`)
|
|
52
|
+
throw new Error(`Unable to obtain Selenium Manager at ${filePath}`)
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
if (!debugMessagePrinted) {
|
|
56
56
|
console.debug(`Selenium Manager binary found at ${filePath}`)
|
|
57
|
-
debugMessagePrinted = true
|
|
57
|
+
debugMessagePrinted = true // Set the flag to true after printing the debug message
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
return filePath
|
|
@@ -82,19 +82,17 @@ function driverLocation(options) {
|
|
|
82
82
|
args.push('--browser-path', path.resolve(vendorOptions.binary))
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
const proxyOptions = options.getProxy()
|
|
85
|
+
const proxyOptions = options.getProxy()
|
|
86
86
|
|
|
87
87
|
// Check if proxyOptions exists and has properties
|
|
88
88
|
if (proxyOptions && Object.keys(proxyOptions).length > 0) {
|
|
89
|
-
const httpProxy = proxyOptions['httpProxy']
|
|
90
|
-
const sslProxy = proxyOptions['sslProxy']
|
|
89
|
+
const httpProxy = proxyOptions['httpProxy']
|
|
90
|
+
const sslProxy = proxyOptions['sslProxy']
|
|
91
91
|
|
|
92
92
|
if (httpProxy !== undefined) {
|
|
93
|
-
args.push('--proxy', httpProxy)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
else if (sslProxy !== undefined) {
|
|
97
|
-
args.push('--proxy', sslProxy);
|
|
93
|
+
args.push('--proxy', httpProxy)
|
|
94
|
+
} else if (sslProxy !== undefined) {
|
|
95
|
+
args.push('--proxy', sslProxy)
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
98
|
|
|
@@ -139,7 +137,7 @@ function driverLocation(options) {
|
|
|
139
137
|
}
|
|
140
138
|
}
|
|
141
139
|
|
|
142
|
-
function logOutput
|
|
140
|
+
function logOutput(output) {
|
|
143
141
|
for (const key in output.logs) {
|
|
144
142
|
if (output.logs[key].level === 'WARN') {
|
|
145
143
|
console.warn(`${output.logs[key].message}`)
|
package/firefox.js
CHANGED
|
@@ -591,7 +591,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
591
591
|
configureExecutor(executor)
|
|
592
592
|
} else if (opt_executor instanceof remote.DriverService) {
|
|
593
593
|
if (!opt_executor.getExecutable()) {
|
|
594
|
-
const {driverPath, browserPath} = getPath(caps)
|
|
594
|
+
const { driverPath, browserPath } = getPath(caps)
|
|
595
595
|
opt_executor.setExecutable(driverPath)
|
|
596
596
|
firefoxBrowserPath = browserPath
|
|
597
597
|
}
|
|
@@ -600,7 +600,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
600
600
|
} else {
|
|
601
601
|
let service = new ServiceBuilder().build()
|
|
602
602
|
if (!service.getExecutable()) {
|
|
603
|
-
const {driverPath, browserPath} = getPath(caps)
|
|
603
|
+
const { driverPath, browserPath } = getPath(caps)
|
|
604
604
|
service.setExecutable(driverPath)
|
|
605
605
|
firefoxBrowserPath = browserPath
|
|
606
606
|
}
|
|
@@ -614,7 +614,7 @@ class Driver extends webdriver.WebDriver {
|
|
|
614
614
|
vendorOptions['binary'] = firefoxBrowserPath
|
|
615
615
|
caps.set(FIREFOX_CAPABILITY_KEY, vendorOptions)
|
|
616
616
|
} else {
|
|
617
|
-
caps.set(FIREFOX_CAPABILITY_KEY, {binary: firefoxBrowserPath})
|
|
617
|
+
caps.set(FIREFOX_CAPABILITY_KEY, { binary: firefoxBrowserPath })
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
|
|
@@ -119,4 +119,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.
|
|
|
119
119
|
}};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};
|
|
120
120
|
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]};
|
|
121
121
|
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}
|
|
122
|
-
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);};
|
|
122
|
+
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({navigator:typeof window!='undefined'?window.navigator:null,document:typeof window!='undefined'?window.document:null}, arguments);};
|
|
@@ -98,4 +98,4 @@ Uc.prototype.set=function(a,b){Object.prototype.hasOwnProperty.call(this.b,a)||(
|
|
|
98
98
|
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");
|
|
99
99
|
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,"[","{");
|
|
100
100
|
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,
|
|
101
|
-
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);};
|
|
101
|
+
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({navigator:typeof window!='undefined'?window.navigator:null,document:typeof window!='undefined'?window.document:null}, arguments);};
|
|
@@ -98,4 +98,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(
|
|
|
98
98
|
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);
|
|
99
99
|
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)}}
|
|
100
100
|
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)}
|
|
101
|
-
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);};
|
|
101
|
+
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({navigator:typeof window!='undefined'?window.navigator:null,document:typeof window!='undefined'?window.document:null}, arguments);};
|
package/lib/by.js
CHANGED
|
@@ -396,7 +396,11 @@ class RelativeBy {
|
|
|
396
396
|
* strategy.
|
|
397
397
|
*/
|
|
398
398
|
function check(locator) {
|
|
399
|
-
if (
|
|
399
|
+
if (
|
|
400
|
+
locator instanceof By ||
|
|
401
|
+
locator instanceof RelativeBy ||
|
|
402
|
+
typeof locator === 'function'
|
|
403
|
+
) {
|
|
400
404
|
return locator
|
|
401
405
|
}
|
|
402
406
|
|
package/package.json
CHANGED
package/remote/index.js
CHANGED
package/remote/util.js
CHANGED
|
@@ -37,7 +37,11 @@ function getJavaPath() {
|
|
|
37
37
|
function isSelenium3x(seleniumStandalonePath) {
|
|
38
38
|
const javaPath = getJavaPath()
|
|
39
39
|
|
|
40
|
-
const execRes = cp.execFileSync(javaPath, [
|
|
40
|
+
const execRes = cp.execFileSync(javaPath, [
|
|
41
|
+
'-jar',
|
|
42
|
+
seleniumStandalonePath,
|
|
43
|
+
'--version',
|
|
44
|
+
])
|
|
41
45
|
|
|
42
46
|
return execRes.toString().trim().startsWith('Selenium server version: 3')
|
|
43
47
|
}
|