Last active
June 15, 2022 17:44
-
-
Save tbiethman/9add1e991efbecdbe3e6eddec9fb4b46 to your computer and use it in GitHub Desktop.
Simple script using chrome-remote-interface to detect active targets
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
// https://www.npmjs.com/package/chrome-remote-interface | |
const CRI = require('chrome-remote-interface') | |
const run = async () => { | |
const versionInfo = await CRI.Version({ host: '127.0.0.1', port: 51959 }) | |
const cri = await CRI({ | |
target: versionInfo.webSocketDebuggerUrl, | |
local: true, | |
}) | |
const targets = await cri.send('Target.getTargets') | |
console.log('found targets') | |
console.log(targets) | |
} | |
try { | |
run() | |
} catch (e) { | |
console.log(e) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment