Using button.foo as both the definition for the browser being on the page and also what you're clicking in the do_foo method makes this example a bit confusing. The page will indeed wait, but not because of the is_browser_on_page (because q is unguarded). Instead it is waiting because of the promise built into query execution.