title: How to waitFor when page refreshes in Puppeteer?
body: <p>I have an app I'm working with that is behaving like this... You visit a url <code>/refresh</code>, and it loads the page with a loader/spinner/bar showing for like 5 seconds, then it refreshes the page after it's done. It does this so it can load the latest data that was computed during <code>/refresh</code>.</p>
  
  <p>Right now I am just setting a timeout longer than the loader will <em>most likely</em> stay around, but this is brittle because a bad network connection could put it over the line.</p>
  
  <p>How can I instead "watch" for when the refresh happens? What technique would you recommend. It seems to start to get hairy pretty fast.</p>
  
  <p>Into the nitty gritty, when the loader is showing, when it finishes it is gone for like a half a second <em>before</em> the page reload. So I can't just wait til the loader is gone. It seems like I need to keep some sort of state variable around in the DOM like in <code>localStorage</code>, but can't pinpoint it. Would love some help.</p>