Skip to content

Commit 2c1bd8e

Browse files
committed
[javascript] Selenium Manager get Browser Version from Options classes
1 parent 2b4f9d8 commit 2c1bd8e

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

javascript/javascript.iml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<module type="WEB_MODULE" version="4">
3+
<component name="ModuleRunConfigurationManager">
4+
<shared />
5+
</component>
36
<component name="NewModuleRootManager" inherit-compiler-output="true">
47
<exclude-output />
58
<content url="file://$MODULE_DIR$" />

javascript/node/selenium-webdriver/common/driverFinder.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ const fs = require('fs')
3030
*/
3131
function getPath(service, capabilities) {
3232
try {
33-
return pathExists(service.getExecutable()) ||
34-
driverLocation(capabilities.getBrowserName())
33+
return pathExists(service.getExecutable()) || driverLocation(capabilities)
3534
} catch (e) {
3635
throw Error(
3736
`Unable to obtain browser driver.

javascript/node/selenium-webdriver/common/seleniumManager.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,24 @@ function getBinary() {
5858

5959
/**
6060
* Determines the path of the correct driver
61-
* @param {Browser|string} browser name to fetch the driver
61+
* @param {Capabilities} options browser options to fetch the driver
6262
* @returns {string} path of the driver location
6363
*/
6464

65-
function driverLocation(browser) {
66-
if (!Browser.includes(browser.toLocaleString())) {
65+
function driverLocation(options) {
66+
if (!Browser.includes(options.getBrowserName().toLocaleString())) {
6767
throw new Error(
68-
`Unable to locate driver associated with browser name: ${browser}`
68+
`Unable to locate driver associated with browser name: ${options.getBrowserName()}`
6969
)
7070
}
7171

72-
let args = [getBinary(), '--browser', browser, '--output', 'json']
72+
let args = [getBinary(), '--browser', options.getBrowserName(), '--output', 'json']
73+
74+
if (options.getBrowserVersion() && options.getBrowserVersion() !== "") {
75+
console.log("Present browserVersion! " + options.getBrowserVersion())
76+
args.push("--browser-version", options.getBrowserVersion())
77+
}
78+
7379
let output
7480

7581
try {

0 commit comments

Comments
 (0)