public function start($browserName = null)
    {
        if ($this->started) {
            throw new Exception\ConnectionException('Client is already started');
        }

        if (!$this->con->isProxyStarted()) {
            throw new Exception\ConnectionException('Sahi proxy seems not running');
        }

        // open browser if connection uses custom SID (not defaultly autogenerated)
        if (!$this->con->isCustomSidProvided()) {
            if (null === $browserName) {
                throw new \InvalidArgumentException('Specify browser to run in');
            }

            $this->con->start($browserName);

            $limit = 600;
            while (!$this->con->isReady()) {
                usleep(100000);
                if (--$limit <= 0) {
                    throw new Exception\ConnectionException(
                        'Connection time limit reached'
                    );
                }
            }

            $this->browserAutoruned = true;
        } elseif (!$this->con->isReady()) {
            throw new Exception\ConnectionException(sprintf(
                "Can not connect to Sahi session with id \"%s\".\n".
                "Start Sahi session in target browser by opening:\n".
                "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=%s&startUrl=http://sahi.example.com/_s_/dyn/Driver_initialized",
                $this->con->getSid(),
                $this->con->getSid()
            ));
        }

        $this->started = true;
    }
public function start($browserName = null)
    {
        if ($this->started) {
            throw new Exception\ConnectionException('Client is already started');
        }

        if (!$this->con->isProxyStarted()) {
            throw new Exception\ConnectionException('Sahi proxy seems not running');
        }

        // open browser if connection uses custom SID (not defaultly autogenerated)
        if (!$this->con->isCustomSidProvided()) {
            if (null === $browserName) {
                throw new \InvalidArgumentException('Specify browser to run in');
            }

            $this->con->start($browserName);

            $limit = 600;
            while (!$this->con->isReady()) {
                usleep(100000);
                if (--$limit <= 0) {
                    throw new Exception\ConnectionException(
                        'Connection time limit reached'
                    );
                }
            }

            $this->browserAutoruned = true;
        } elseif (!$this->con->isReady()) {
            throw new Exception\ConnectionException(sprintf(
                "Can not connect to Sahi session with id \"%s\".\n".
                "Start Sahi session in target browser by opening:\n".
                "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=%s&startUrl=http://sahi.example.com/_s_/dyn/Driver_initialized",
                $this->con->getSid(),
                $this->con->getSid()
            ));
        }

        $this->started = true;
    }
public function start ( $ browserName = null ) { if ( $ this -> started ) { throw new Exception \ ConnectionException ( 'Client is already started' ) ; } if ( ! $ this -> con -> isProxyStarted ( ) ) { throw new Exception \ ConnectionException ( 'Sahi proxy seems not running' ) ; } // open browser if connection uses custom SID (not defaultly autogenerated) if ( ! $ this -> con -> isCustomSidProvided ( ) ) { if ( null === $ browserName ) { throw new \ InvalidArgumentException ( 'Specify browser to run in' ) ; } $ this -> con -> start ( $ browserName ) ; $ limit = 600 ; while ( ! $ this -> con -> isReady ( ) ) { usleep ( 100000 ) ; if ( -- $ limit <= 0 ) { throw new Exception \ ConnectionException ( 'Connection time limit reached' ) ; } } $ this -> browserAutoruned = true ; } elseif ( ! $ this -> con -> isReady ( ) ) { throw new Exception \ ConnectionException ( sprintf ( "Can not connect to Sahi session with id \"%s\".\n" . "Start Sahi session in target browser by opening:\n" . "http://sahi.example.com/_s_/dyn/Driver_start?sahisid=%s&startUrl=http://sahi.example.com/_s_/dyn/Driver_initialized" , $ this -> con -> getSid ( ) , $ this -> con -> getSid ( ) ) ) ; } $ this -> started = true ; }
Start Sahi browser session.

@param string $browserName (firefox, ie, safari, chrome, opera)

@throws Exception\ConnectionException
@throws \InvalidArgumentException
Start Sahi browser session .