/**
  * @param WebDriverCommand $command
  * @param array            $curl_opts
  *
  * @return mixed
  * @throws WebDriverException
  * @throws \Exception
  */
 public function execute(WebDriverCommand $command, $curl_opts = array())
 {
     if ($command->getName() === DriverCommand::NEW_SESSION) {
         $this->service->start();
     }
     try {
         $value = parent::execute($command);
         if ($command->getName() === DriverCommand::QUIT) {
             $this->service->stop();
         }
         return $value;
     } catch (\Exception $e) {
         if (!$this->service->isRunning()) {
             throw new WebDriverException('The driver server has died.');
         }
         throw $e;
     }
 }
예제 #2
0
 public function execute($command_name, $params = array())
 {
     $command = new WebDriverCommand($this->sessionID, $command_name, $params);
     $response = $this->executor->execute($command);
     return $response->getValue();
 }