Ejemplo n.º 1
0
 /**
  * Start Sahi browser session.
  *
  * @param   string  $browserName    (firefox, ie, safari, chrome, opera)
  */
 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;
 }
Ejemplo n.º 2
0
 /**
  * Starts the browser on the server.
  *
  * @return Browser Fluid interface
  */
 public function start()
 {
     $this->driver->start($this->type, $this->startPage);
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * Starts a session
  *
  * @return boolean
  */
 public function start()
 {
     return $this->driver->start();
 }