Use an ENV to trigger --remote-debugging-port instead.

This commit is contained in:
Guo Xiang Tan 2018-04-12 10:10:45 +08:00
parent 3d5a55b55b
commit 71b2f8ae1d

View File

@ -18,15 +18,19 @@ const CDP = require('chrome-remote-interface');
(function() {
function launchChrome() {
return chromeLauncher.launch({
// Uncomment this to enable `--remote-debugging-port`
// port: 9222,
const options = {
chromeFlags: [
'--disable-gpu',
'--headless',
'--no-sandbox'
]
});
}
if (process.env.REMOTE_DEBUG) {
options.port = 9222;
}
return chromeLauncher.launch(options);
}
launchChrome().then(chrome => {