Skip to content

Commit

Permalink
[js] Add a check for Grid CDP endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani authored Sep 20, 2021
1 parent 9cc81ec commit 41dfb46
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions javascript/node/selenium-webdriver/lib/webdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,19 @@ class WebDriver {
if (target && cdpTargets.indexOf(target.toLowerCase()) === -1) {
throw new error.InvalidArgumentError('invalid target value')
}

if (debuggerAddress.match(/\/se\/cdp/)) {
if (debuggerAddress.match("ws:\/\/", "http:\/\/")) {
return debuggerAddress.replace("ws:\/\/", "http:\/\/")
}
else if (debuggerAddress.match("wss:\/\/", "https:\/\/")) {
return debuggerAddress.replace("wss:\/\/", "https:\/\/")
}
else {
return debuggerAddress
}
}

const path = '/json/version'
let request = new http.Request('GET', path)
let client = new http.HttpClient('http://' + debuggerAddress)
Expand Down

0 comments on commit 41dfb46

Please sign in to comment.