Created
January 4, 2019 23:09
-
-
Save mohummedalee/4416c75b994142af1624bc15ca9668be to your computer and use it in GitHub Desktop.
Pulling out the web-socket URL of a Chrome Debugging Protocol run – can be used to connect other services (e.g. Puppeteer) to CDP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request'); | |
// Assuming CDP is running on localhost | |
Browser.prototype.setupWSURL = async function() { | |
let that = this; | |
let url = `http://localhost:${this.port}/json/version`; | |
request(url, | |
function(err, resp, body) { | |
if (!err) { | |
that.webSocketDebuggerUrl = JSON.parse(body).webSocketDebuggerUrl; | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment