title: NodeJS Puppeteer: TypeError: Cannot read property 'setAttribute' of null
body: <p>I've been getting the error <strong>TypeError: Cannot read property 'setAttribute' of null</strong></p>
  
  <p>This is the element:</p>
  
  <pre><code>&lt;input type="text" name="fields[name]" class="form-control" placeholder="Full 
  Name*" autocomplete="name" x-autocompletetype="name" 
  spellcheck="false" autocapitalize="off" autocorrect="off"&gt;
  </code></pre>
  
  <p>And this is my code (using puppeteer):</p>
  
  <pre><code>  const browser = await puppeteer.launch({headless: false});
    const page = await browser.newPage();
    await page.setUserAgent(userAgents[Math.floor(Math.random()*userAgents.length)]);
  
    await page.goto('website here');
  
    await page.evaluate(() =&gt; {
  
      document.querySelector('[placeholder="Full Name*"]').setAttribute('value', 'test');
  
    });
  </code></pre>
  
  <p>I have also used:</p>
  
  <pre><code>document.querySelector('[name="fields[name]"]').setAttribute('value', 'Test');
  </code></pre>
  
  <p>And I have also tried using xpath, all which have failed.</p>
  
  <p><strong>It is important to note that the querySelector line runs fine in chrome console so I don't know why its not working here...</strong> Any help is appreciated.</p>