title: Puppeteer: How to handle multiple tabs?
body: <p>Scenario: Web form for developer app registration with two part workflow.</p>
  
  <p>Page 1: Fill out developer app details and click on button to create Application ID, which opens, in a new tab...</p>
  
  <p>Page 2: The App ID page. I need to copy the App ID from this page, then close the tab and go back to Page 1 and fill in the App ID (saved from Page 2), then submit the form.</p>
  
  <p>I understand basic usage - how to open Page 1 and click the button which opens Page 2 - but how do I get a handle on Page 2 when it opens in a new tab?</p>
  
  <p>Example:</p>
  
  <pre><code>const puppeteer = require('puppeteer');
  
  (async() =&gt; {
      const browser = await puppeteer.launch({headless: false, executablePath: '/Applications/Google Chrome.app'});
      const page = await browser.newPage();
  
      // go to the new bot registration page
      await page.goto('https://register.example.com/new', {waitUntil: 'networkidle'});
  
      // fill in the form info
      const form = await page.$('new-app-form');
  
      await page.focus('#input-appName');
      await page.type('App name here');
  
      await page.focus('#input-appDescription');
      await page.type('short description of app here');
  
      await page.click('.get-appId'); //opens new tab with Page 2
  
      // handle Page 2
      // get appID from Page 2
      // close Page 2
  
      // go back to Page 1
      await page.focus('#input-appId');
      await page.type(appIdSavedFromPage2);
  
      // submit the form
      await form.evaluate(form =&gt; form.submit());
  
      browser.close();
  })();
  </code></pre>
  
  <p><strong>Update 2017-10-25</strong> </p>
  
  <ul>
  <li>The work for Browser.pages has been <a href="https://github.com/GoogleChrome/puppeteer/pull/554" rel="noreferrer">completed</a> and <a href="https://github.com/GoogleChrome/puppeteer/commit/32398d11bdc2cd01c9cfe3e706f629ef90179c91" rel="noreferrer">merged</a> </li>
  <li>Fixes <a href="https://github.com/GoogleChrome/puppeteer/issues/386" rel="noreferrer">Emit new Page objects when new tabs created #386</a> and <a href="https://github.com/GoogleChrome/puppeteer/issues/443" rel="noreferrer">Request: browser.currentPage() or similar way to access Pages #443</a>.</li>
  </ul>
  
  <p>Still looking for a good usage example.</p>