Last active
November 11, 2018 09:58
-
-
Save auchenberg/355b77886a5b93427d2ff6c592f4b064 to your computer and use it in GitHub Desktop.
Microsoft Edge Diagnostics + chrome-remote-inteface example
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
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) | |
}) |
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
{ | |
"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