title: Complicated CSS selector in Puppeteer
body: <p>Is there a shorter method to wait for <em>complicated</em> selector?</p>
  
  <pre><code>await page.evaluate(() =&gt; {
    return new Promise(resolve =&gt; {
       var aid = setInterval(function(){
          let block = $('div[class="asset"]:contains("Assets Folder")');
  
          if(block.length){
             clearInterval(aid);
             block.click();
             resolve();
          }
  
       }, 100);
    })
  });
  </code></pre>
  
  <p><code>page.waitFor()</code> throws an error:</p>
  
  <blockquote>
    <p>Error: Evaluation failed: DOMException: Failed to execute 'querySelector' on 'Document': 'div[class="asset"]:contains("Assets Folder")' is not a valid selector.</p>
  </blockquote>