selenium-webdriver 4.11.1 → 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 +24 -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 +18 -14
- package/firefox.js +3 -3
- package/lib/by.js +5 -1
- package/package.json +4 -4
- package/remote/index.js +0 -1
- package/remote/util.js +5 -1
- package/testing/index.js +12 -7
package/CHANGES.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
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
|
+
|
|
12
|
+
## 4.12.0
|
|
13
|
+
|
|
14
|
+
#### :bug: Bug fix
|
|
15
|
+
|
|
16
|
+
* Adding browsers when they are present on the host (#12456)
|
|
17
|
+
* Create absolute path for browser binary (#12479)
|
|
18
|
+
* Fix how browsers and drivers are discovered (#12456)
|
|
19
|
+
|
|
20
|
+
#### :nail_care: Polish
|
|
21
|
+
|
|
22
|
+
* Add support for Chrome 116 and remove support for Chrome 113
|
|
23
|
+
* Remove browserVersion from options in Selenium Manager (#12641)
|
|
24
|
+
|
|
1
25
|
## 4.11.1
|
|
2
26
|
|
|
3
27
|
#### :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()
|
|
@@ -25,8 +25,9 @@ const { platform } = require('process')
|
|
|
25
25
|
const path = require('path')
|
|
26
26
|
const fs = require('fs')
|
|
27
27
|
const spawnSync = require('child_process').spawnSync
|
|
28
|
+
const { Capability } = require('../lib/capabilities')
|
|
28
29
|
|
|
29
|
-
let debugMessagePrinted = false
|
|
30
|
+
let debugMessagePrinted = false
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* Determines the path of the correct Selenium Manager binary
|
|
@@ -45,15 +46,15 @@ function getBinary() {
|
|
|
45
46
|
|
|
46
47
|
let seleniumManagerBasePath = path.join(__dirname, '..', '/bin')
|
|
47
48
|
|
|
48
|
-
const filePath = path.join(seleniumManagerBasePath, directory, file)
|
|
49
|
+
const filePath = process.env.SE_MANAGER_PATH || path.join(seleniumManagerBasePath, directory, file)
|
|
49
50
|
|
|
50
51
|
if (!fs.existsSync(filePath)) {
|
|
51
|
-
throw new Error(`Unable to obtain Selenium Manager`)
|
|
52
|
+
throw new Error(`Unable to obtain Selenium Manager at ${filePath}`)
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
if (!debugMessagePrinted) {
|
|
55
56
|
console.debug(`Selenium Manager binary found at ${filePath}`)
|
|
56
|
-
debugMessagePrinted = true
|
|
57
|
+
debugMessagePrinted = true // Set the flag to true after printing the debug message
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
return filePath
|
|
@@ -78,22 +79,20 @@ function driverLocation(options) {
|
|
|
78
79
|
options.get('ms:edgeOptions') ||
|
|
79
80
|
options.get('moz:firefoxOptions')
|
|
80
81
|
if (vendorOptions && vendorOptions.binary && vendorOptions.binary !== '') {
|
|
81
|
-
args.push('--browser-path',
|
|
82
|
+
args.push('--browser-path', path.resolve(vendorOptions.binary))
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
const proxyOptions = options.getProxy()
|
|
85
|
+
const proxyOptions = options.getProxy()
|
|
85
86
|
|
|
86
87
|
// Check if proxyOptions exists and has properties
|
|
87
88
|
if (proxyOptions && Object.keys(proxyOptions).length > 0) {
|
|
88
|
-
const httpProxy = proxyOptions['httpProxy']
|
|
89
|
-
const sslProxy = proxyOptions['sslProxy']
|
|
89
|
+
const httpProxy = proxyOptions['httpProxy']
|
|
90
|
+
const sslProxy = proxyOptions['sslProxy']
|
|
90
91
|
|
|
91
92
|
if (httpProxy !== undefined) {
|
|
92
|
-
args.push('--proxy', httpProxy)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
else if (sslProxy !== undefined) {
|
|
96
|
-
args.push('--proxy', sslProxy);
|
|
93
|
+
args.push('--proxy', httpProxy)
|
|
94
|
+
} else if (sslProxy !== undefined) {
|
|
95
|
+
args.push('--proxy', sslProxy)
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
|
|
@@ -126,6 +125,11 @@ function driverLocation(options) {
|
|
|
126
125
|
)
|
|
127
126
|
}
|
|
128
127
|
|
|
128
|
+
// Once driverPath is available, delete browserVersion from payload
|
|
129
|
+
if (output.result.driver_path) {
|
|
130
|
+
options.delete(Capability.BROWSER_VERSION)
|
|
131
|
+
}
|
|
132
|
+
|
|
129
133
|
logOutput(output)
|
|
130
134
|
return {
|
|
131
135
|
driverPath: output.result.driver_path,
|
|
@@ -133,7 +137,7 @@ function driverLocation(options) {
|
|
|
133
137
|
}
|
|
134
138
|
}
|
|
135
139
|
|
|
136
|
-
function logOutput
|
|
140
|
+
function logOutput(output) {
|
|
137
141
|
for (const key in output.logs) {
|
|
138
142
|
if (output.logs[key].level === 'WARN') {
|
|
139
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
|
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "selenium-webdriver",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
4
4
|
"description": "The official WebDriver JavaScript bindings from the Selenium project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"ws": ">=8.13.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"eslint": "^8.
|
|
32
|
-
"eslint-config-prettier": "^
|
|
31
|
+
"eslint": "^8.46.0",
|
|
32
|
+
"eslint-config-prettier": "^9.0.0",
|
|
33
33
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
34
34
|
"eslint-plugin-node": "^11.1.0",
|
|
35
35
|
"eslint-plugin-prettier": "^5.0.0",
|
|
36
36
|
"express": "^4.18.2",
|
|
37
37
|
"mocha": "^10.2.0",
|
|
38
38
|
"multer": "^1.4.5-lts.1",
|
|
39
|
-
"prettier": "^3.0.
|
|
39
|
+
"prettier": "^3.0.1",
|
|
40
40
|
"serve-index": "^1.9.1",
|
|
41
41
|
"sinon": "^15.2.0"
|
|
42
42
|
},
|
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
|
}
|
package/testing/index.js
CHANGED
|
@@ -118,19 +118,24 @@ function getAvailableBrowsers() {
|
|
|
118
118
|
info(`Searching for WebDriver executables installed on the current system...`)
|
|
119
119
|
|
|
120
120
|
let targets = [
|
|
121
|
-
[getPath(new chrome.Options())
|
|
122
|
-
[getPath(new edge.Options())
|
|
123
|
-
[getPath(new firefox.Options())
|
|
124
|
-
[getPath(new ie.Options()).driverPath, Browser.INTERNET_EXPLORER],
|
|
125
|
-
[getPath(new safari.Options()).driverPath, Browser.SAFARI],
|
|
121
|
+
[getPath(new chrome.Options()), Browser.CHROME],
|
|
122
|
+
[getPath(new edge.Options()), Browser.EDGE],
|
|
123
|
+
[getPath(new firefox.Options()), Browser.FIREFOX],
|
|
126
124
|
]
|
|
125
|
+
if (process.platform === 'win32') {
|
|
126
|
+
targets.push([getPath(new ie.Options()), Browser.INTERNET_EXPLORER])
|
|
127
|
+
}
|
|
128
|
+
if (process.platform === 'darwin') {
|
|
129
|
+
targets.push([getPath(new safari.Options()), Browser.SAFARI])
|
|
130
|
+
}
|
|
127
131
|
|
|
128
132
|
let availableBrowsers = []
|
|
129
133
|
for (let pair of targets) {
|
|
130
|
-
const driverPath = pair[0]
|
|
134
|
+
const driverPath = pair[0].driverPath
|
|
135
|
+
const browserPath = pair[0].browserPath
|
|
131
136
|
const name = pair[1]
|
|
132
137
|
const capabilities = pair[2]
|
|
133
|
-
if (driverPath.length > 0) {
|
|
138
|
+
if (driverPath.length > 0 && browserPath && browserPath.length > 0) {
|
|
134
139
|
info(`... located ${name}`)
|
|
135
140
|
availableBrowsers.push({ name, capabilities })
|
|
136
141
|
}
|