title: How do you wait for a selector, but only for a specific time period in puppeteer?
body: <p>I'm scraping data from youtube and trying to get the number of comments. I'm trying to grab the element that contains the value, but in case the comments are disabled for a video, that element doesn't exist at all and <code>waitForSelector()</code> waits, I think, for about 30 seconds before ending the program. How can I tell puppeteer to wait for that element for, say, 5 seconds and if it doesn't exist, move on with the rest of the code?</p>
  
  <p>Here's the code that I'm using-</p>
  
  <pre><code>await page.waitForSelector("yt-formatted-string.count-text.style-scope.ytd-comments-header-renderer")
  let commentCount = await (await (await page.$("yt-formatted-string.count-text.style-scope.ytd-comments-header-renderer")).getProperty("textContent")).jsonValue()
  </code></pre>