title: How select an element by xpath and click on it with puppeteer?
body: <p>I tried this simple example to click a link, but it seems that it's not working.
  The example is bascily to click a login button in youtube.com
  error throw</p>
  <pre><code>(node:12304) UnhandledPromiseRejectionWarning: TypeError: youtubeLoginButton.evaluate is not a function
      at C:\Users\GoodBoy\Desktop\code\Puppeteer\scrape-content-from-website\bot.js:17:30
      at processTicksAndRejections (internal/process/task_queues.js:94:5)
  (node:12304) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise 
  which was not handled with .catch(). (rejection id: 1)
  (node:12304) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero 
  exit code.
  </code></pre>
  <pre class="lang-js prettyprint-override"><code>const puppeteer = require('puppeteer')
  
  ;(async () =&gt; {
      const browser = await puppeteer.launch({
          headless: false,
          defaultViewport: null,
          args: ['--start-maximized'],
      })
      const page = await browser.newPage()
  
      await page.goto('https://www.youtube.com/')
  
      const youtubeLoginButtonXpath = '//*[@id=&quot;buttons&quot;]/ytd-button-renderer/a'
  
      const youtubeLoginButton = await page.$x(youtubeLoginButtonXpath)
  
      await youtubeLoginButton.evaluate((form) =&gt; form.click())
  
      await browser.close()
  })()
  
  </code></pre>