({ debugPort, userDataDir })
| 295 | } |
| 296 | |
| 297 | function startChrome({ debugPort, userDataDir }) { |
| 298 | const chromePath = findChromePath() |
| 299 | const child = spawn( |
| 300 | chromePath, |
| 301 | [ |
| 302 | `--remote-debugging-port=${debugPort}`, |
| 303 | `--user-data-dir=${userDataDir}`, |
| 304 | '--headless=new', |
| 305 | '--disable-background-networking', |
| 306 | '--disable-default-apps', |
| 307 | '--disable-extensions', |
| 308 | '--disable-gpu', |
| 309 | '--disable-sync', |
| 310 | '--js-flags=--expose-gc', |
| 311 | '--metrics-recording-only', |
| 312 | '--no-default-browser-check', |
| 313 | '--no-first-run', |
| 314 | 'about:blank' |
| 315 | ], |
| 316 | { |
| 317 | stdio: ['ignore', 'pipe', 'pipe'] |
| 318 | } |
| 319 | ) |
| 320 | let log = '' |
| 321 | child.stdout.on('data', (chunk) => { |
| 322 | log = appendBounded(log, chunk) |
| 323 | }) |
| 324 | child.stderr.on('data', (chunk) => { |
| 325 | log = appendBounded(log, chunk) |
| 326 | }) |
| 327 | return { |
| 328 | child, |
| 329 | log: () => log |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | class CdpClient { |
| 334 | constructor(webSocketUrl) { |
no test coverage detected