Prose\UsingBrowser::gotoPage PHP Method

gotoPage() public method

------------------------------------------------------------------
public gotoPage ( $url )
    public function gotoPage($url)
    {
        // some shorthand to make things easier to read
        $browser = $this->device;
        // relative, or absolute URL?
        if (substr($url, 0, 1) == '/') {
            // only absolute URLs are supported
            throw new E5xx_ActionFailed(__METHOD__, 'only absolute URLs are supported');
        }
        // parse the URL
        $urlParts = parse_url($url);
        // if we have no host, we cannot continue
        if (isset($urlParts['host'])) {
            // do we have any HTTP AUTH credentials to merge in?
            if (fromBrowser()->hasHttpBasicAuthForHost($urlParts['host'])) {
                $adapter = $this->st->getDeviceAdapter();
                // the adapter *might* embed the authentication details
                // into the URL
                $url = $adapter->applyHttpBasicAuthForHost($urlParts['host'], $url);
            }
        }
        // what are we doing?
        $log = usingLog()->startAction("goto URL: {$url}");
        // tell the browser to move to the page we want
        $browser->open($url);
        // all done
        $log->endAction();
    }