smarter waiting for the page to run