title: How to use proxy in puppeteer and headless Chrome?
body: <p>Please tell me how to properly use a proxy with a puppeteer and headless Chrome. My option does not work.</p>
  
  <pre><code>const puppeteer = require('puppeteer');
  (async () =&gt; {
    const argv = require('minimist')(process.argv.slice(2));
  
    const browser = await puppeteer.launch({args: ["--proxy-server =${argv.proxy}","--no-sandbox", "--disable-setuid-sandbox"]});
    const page = await browser.newPage();
  
    await page.setJavaScriptEnabled(false);
    await page.setUserAgent(argv.agent);
    await page.setDefaultNavigationTimeout(20000);
    try{
    await page.goto(argv.page);
  
    const bodyHTML = await page.evaluate(() =&gt; new XMLSerializer().serializeToString(document))
    body = bodyHTML.replace(/\r|\n/g, '');
    console.log(body);
  }catch(e){
          console.log(e);
  }
    await browser.close();
  })();
  </code></pre>