Skip to content

Instantly share code, notes, and snippets.

@auchenberg
Last active November 11, 2018 09:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save auchenberg/355b77886a5b93427d2ff6c592f4b064 to your computer and use it in GitHub Desktop.
Save auchenberg/355b77886a5b93427d2ff6c592f4b064 to your computer and use it in GitHub Desktop.
Microsoft Edge Diagnostics + chrome-remote-inteface example
var launch = require('edge-diagnostics-launch')
var chrome = require('chrome-remote-interface')
var url = 'https://github.com/'
var options = {
chooseTab: function(tabs) {
var targetTab = tabs.filter(function(tab) {
return tab.url == url
})
if(targetTab.length) {
return tabs.indexOf(targetTab[0])
}
return 0
}
}
console.log('Launching Edge')
var edge = launch(url, {}, function(err) {
console.log('.. Launched!')
console.log('Trying connect to Edge...')
chrome(options, function(client) {
console.log('.. Connected!')
client.Page.enable();
client.once('ready', function () {
client.Page.navigate({
'url': 'https://microsoft.com'
})
});
}).on('error', function(err) {
console.error('Cannot connect to Edge', err)
})
})
edge.stdout.on('data', function(data) {
console.log('stdout: ' + data)
})
edge.stderr.on('data', function(data) {
console.log('stderr: ' + data)
})
edge.on('exit', function(code) {
console.log('child process exited with code ' + code)
})
{
"name": "edge-cli-example",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"chrome-remote-interface": "^0.11.1",
"edge-diagnostics-launch": "^1.1.3"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment