title: Puppeteer multiline waitForFunction method
body: <p>I'm using the Puppeteer <code>page.waitForFunction()</code> method:</p>
  <pre><code>await page.waitForFunction(`
      (window.hero.x - 1 === ${x} || window.hero.x === ${x} || window.hero.x + 1 === ${x} || window.hero.x === ${x}) &amp;&amp; (window.hero.y - 1 === ${y} || window.hero.y === ${y} || window.hero.y + 1 === ${y} || window.hero.y === ${y}) || window.hero.x === ${x} &amp;&amp; window.hero.y === ${y}
  `);
  </code></pre>
  <p>It's working but looks terrible. I want to change it to multiline. <a href="https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitforfunctionpagefunction-options-args" rel="nofollow noreferrer">In docs</a> there is:</p>
  <blockquote>
  <p><code>page.waitForFunction(pageFunction[, options[, ...args]])</code></p>
  <p>pageFunction <code>&lt;function|string&gt;</code> Function to be evaluated in browser context</p>
  <p>To pass arguments from node.js to the predicate of <code>page.waitForFunction</code> function:</p>
  <pre><code>const selector = '.foo';
  await page.waitForFunction(selector =&gt; !!document.querySelector(selector), {}, selector);
  </code></pre>
  </blockquote>
  <p>I tried like this:</p>
  <pre><code>console.log(x,y); // 24 42
  await page.waitForFunction((x, y) =&gt; {
      console.log(x, y); // undefined, undefined
      if(x &amp;&amp; y) {
          return true;
      }
  });
  </code></pre>
  <p>but <code>x</code> and <code>y</code> which I'm trying to pass are undefined. What I'm doing  wrong?</p>