Nit: I might call this `wait_for_and_switch_to_top_frame`, as the current name doesn't describe what we are waiting for, just that we are waiting.