Prose\UsingBrowser::waitForTitle PHP Method

waitForTitle() public method

public waitForTitle ( $timeout, $title, $failedTitle = null )
    public function waitForTitle($timeout, $title, $failedTitle = null)
    {
        // what are we doing?
        $log = usingLog()->startAction("check that the the right page has loaded");
        // check the title
        usingTimer()->waitFor(function () use($title, $failedTitle) {
            // have we already failed?
            if ($failedTitle && fromBrowser()->getTitle() == $failedTitle) {
                return false;
            }
            // we have not failed yet
            expectsBrowser()->hasTitle($title);
        }, $timeout);
        // all done
        $log->endAction();
    }