Skip to content

Commit 41dfb46

Browse files
authored
[js] Add a check for Grid CDP endpoint
1 parent 9cc81ec commit 41dfb46

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

javascript/node/selenium-webdriver/lib/webdriver.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,19 @@ class WebDriver {
12291229
if (target && cdpTargets.indexOf(target.toLowerCase()) === -1) {
12301230
throw new error.InvalidArgumentError('invalid target value')
12311231
}
1232+
1233+
if (debuggerAddress.match(/\/se\/cdp/)) {
1234+
if (debuggerAddress.match("ws:\/\/", "http:\/\/")) {
1235+
return debuggerAddress.replace("ws:\/\/", "http:\/\/")
1236+
}
1237+
else if (debuggerAddress.match("wss:\/\/", "https:\/\/")) {
1238+
return debuggerAddress.replace("wss:\/\/", "https:\/\/")
1239+
}
1240+
else {
1241+
return debuggerAddress
1242+
}
1243+
}
1244+
12321245
const path = '/json/version'
12331246
let request = new http.Request('GET', path)
12341247
let client = new http.HttpClient('http://' + debuggerAddress)

0 commit comments

Comments
 (0)