getURL()); $this->service = $service; } /** * @param WebDriverCommand $command * * @throws \Exception * @throws WebDriverException * @return WebDriverResponse */ public function execute(WebDriverCommand $command) { 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 DriverServerDiedException($e); } throw $e; } } }