Open andyearnshaw opened 2 years ago
import
import Puppeteer from 'puppeteer';
in case of firefox inside docker set product before running the next part:
Puppeteer._productName = 'firefox'
finaly launch
Puppeteer.launch({
ignoreDefaultArgs: true, // use only our supplyed args: []
executablePath: '/usr/bin/docker', // we want to run docker right?
args: [
// docker arguments
'run',
'-p=9333:9333',
'-p=3000:3000',
'-it',
`${dockerImage}`,
`/usr/bin/google-chrome`,
// end docker arguments
...Puppeteer._launcher.defaultArgs({
devtools: false, // devtools auto open needs headless false
headless: true, // needs to be false if devtools auto open
userDataDir // needs to get set here no where else is optional
}),
// Here comes what you would put into args in general
],
pipe: true
}
maybe usefull https://github.com/docker/cli/issues/3198
This currently doesn't work and I'm too unfamiliar with pipes and file descriptors to fix it right now. This is how Puppeteer sets up the browser process's
stdio
whenpipe: true
is passed in the options:docker run
only supports attaching (--attach
,-a
) tostdin
,stdout
andstderr
so I'm not sure how this might be solved.When Puppeteer runs with this option, the following output is repeatedly logged by Chrome: