Skip to content

Instantly share code, notes, and snippets.

@tbiethman
Last active June 15, 2022 17:44
Show Gist options
  • Save tbiethman/9add1e991efbecdbe3e6eddec9fb4b46 to your computer and use it in GitHub Desktop.
Save tbiethman/9add1e991efbecdbe3e6eddec9fb4b46 to your computer and use it in GitHub Desktop.
Simple script using chrome-remote-interface to detect active targets
// 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