getURL()); $this->service = $service; } /** * @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; } } }