0

我们希望首先在 docker 容器容器上一次调试许多无头 puppeteer 会话,然后在 Kubernetes pod 中。

使用给定参数开始会话:

 const optArgs = [
      '--window-size=1920,1080',     '--no-sandbox',      '--disable-setuid-sandbox',      '--disable-gpu',      '--single-process',      '--no-zygote'
      
      ,'--remote-debugging-port=3002',
      '--remote-debugging-address=0.0.0.0'
    ];

const options = {
      headless: true,
      args: optArgs,
      defaultViewport: null,
      waitUntil: 'networkidle2'
    };

    const browser = await puppeteer.launch(options);
    const wsEndpoint = browser.wsEndpoint();

      const page = (await browser.pages())[0];
      await page.goto(siteUrl, { waitUntil: 'load' });
      return wsEndpoint;

remote-debugging-port=3002 打开 localhost/3002 进行远程调试,但它只看到最后一个会话

我怎样才能到达所有可用于远程调试的会话

4

0 回答 0