title: Click anywhere on page using Puppeteer
body: <p>Currently I'm using Puppeteer to fetch cookies &amp; headers from a page, however it's using a bot prevention system which is only bypassed when clicking on the page; I don't want to keep this sequential so it's &quot;detectable&quot;</p>
  <p>How can I have my Puppeteer click anywhere on the page at random? regardless of wether it clicks a link, button etc..</p>
  <p>I've currently got this code</p>
  <pre><code>const getCookies = async (state) =&gt; {
      try {
          state.browser = await launch_browser(state);
          state.context = await state.browser.createIncognitoBrowserContext();
          state.page = await state.context.newPage();
          await state.page.authenticate({
              username: proxies.username(),
              password: proxies.password(),
          });
          await state.page.setViewport(functions.get_viewport());
          state.page.on('response', response =&gt; handle_response(response, state));
          await state.page.goto('https://www.website.com', {
              waitUntil: 'networkidle0',
          });
          await state.page.waitFor('.unlockLink a', {
              timeout: 5000
          });
          await state.page.click('.unlockLink a');
          await state.page.waitFor('input[id=&quot;nondevice&quot;]', {
              timeout: 5000
          });
          state.publicIpv4Address = await state.page.evaluate(() =&gt; {
              return sessionStorage.getItem(&quot;publicIpv4Address&quot;);
          });
          state.csrfToken = await state.page.evaluate(() =&gt; {
              return sessionStorage.getItem(&quot;csrf-token&quot;);
          });
          //I NEED TO CLICK HERE! CAN BE WHITESPACE, LINK, IMAGE
          state.browser_cookies = await state.page.cookies();
          state.browser.close();
          for (const cookie of state.browser_cookies) {
              if(cookie.name === &quot;dtPC&quot;) {
                  state.dtpc = cookie.value;
              }
              await state.jar.setCookie(
                  `${cookie.name}=${cookie.value}`,
                  'https://www.website.com'
              )
          }
          return state;
      } catch(error) {
          if(state.browser) {
              state.browser.close();
          }
          throw new Error(error);
      }
  };
  </code></pre>