Skip to content

Commit a6c7e03

Browse files
committed
[js] Check if proxy is enabled and allow selenium manager to use proxy options
1 parent 7497e38 commit a6c7e03

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,20 @@ function driverLocation(options) {
8989
args.push('--browser-path', '"' + vendorOptions.binary + '"')
9090
}
9191

92-
// Get the httpProxy and sslProxy values from the options object
93-
const httpProxy = options.getProxy()['httpProxy'];
94-
const sslProxy = options.getProxy()['sslProxy'];
95-
96-
if (httpProxy) {
97-
args.push('--proxy', httpProxy);
98-
} else if (sslProxy) {
99-
args.push('--proxy', sslProxy);
92+
const proxyOptions = options.getProxy();
93+
94+
// Check if proxyOptions exists and has properties
95+
if (proxyOptions && Object.keys(proxyOptions).length > 0) {
96+
const httpProxy = proxyOptions['httpProxy'];
97+
const sslProxy = proxyOptions['sslProxy'];
98+
99+
if (httpProxy !== undefined) {
100+
args.push('--proxy', httpProxy);
101+
}
102+
103+
else if (sslProxy !== undefined) {
104+
args.push('--proxy', sslProxy);
105+
}
100106
}
101107

102108
const smBinary = getBinary()

0 commit comments

Comments
 (0)