title: How puppeteer takes variable from window scope
body: <p>I want to get an object from window scope using the evaluate function. This is my code.</p>
  
  <p>This is the variable in window scope.</p>
  
  <pre><code>let testCase = JSON.stringify({foo: bar});
  </code></pre>
  
  <p>This is the puppeteer code that I use to get the value from testCase variable.</p>
  
  <pre><code>console.log(await page.evaluate(() =&gt; testCase));
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>undefined
  </code></pre>
  
  <p>I know that puppeteer's evaluate function arguments must be serialized that's why I use Json.stringify(), but still doesn't work!</p>
  
  <p>Any help is highly appreciated. Thank you.</p>