title: How to fix Node.js puppeteer keyboard.type() causes TypeError
body: <p>I have some code that is filling out a form. It is able to find all the parts I need but it failes to type in one of them.</p>
  
  <p>At first, I started by just waiting for the input fields to load, then wrote to them with <code>page.type()</code>. The username worked fine but the password failed.
  I split <code>page.type()</code> to <code>page.click()</code> and then <code>page.keyboard.type()</code> in order to isolate the problem. </p>
  
  <p>I'm writing with typescript and running the files with <a href="https://www.npmjs.com/package/ts-node" rel="noreferrer">ts-node</a></p>
  
  <p>The same error was raised on both runs: </p>
  
  <pre><code>TypeError: text is not iterable
      at Keyboard.type (...\node_modules\puppeteer\lib\Input.js:162:24)
      at Keyboard.&lt;anonymous&gt; (...\node_modules\puppeteer\lib\helper.js:112:23)
      at ...\src\backend\index.ts:67:37
      at step (...\src\backend\index.ts:33:23)
      at Object.next (...\src\backend\index.ts:14:53)        
      at fulfilled (...\src\backend\index.ts:5:58)
  </code></pre>
  
  <pre><code>await page.waitFor('input[type="text"]')    // Makes sure the form was loaded
      await page.type('input[type="text"]', user.username);
      await page.waitFor('input[type="password"]')    // Makes sure the form was loaded
      try{
          // await page.type('input[type="password"]', user.password);
          await page.click('input[type="password"]');    // Click password field
          await page.waitFor(5000)
          await page.keyboard.type(user.password);
      }
      catch(e){
          console.error(e)
      }
      await page.waitFor('input[type="submit"]')    // Makes sure the form was loaded
      await page.click('input[type="submit"]');
  </code></pre>
  
  <p>This code definitely worked in another project I had, what can be causing this error?</p>