setCommandExecutor($executor) ->startSession($desired_capabilities); return $driver; } public function startSession($desired_capabilities) { $command = new WebDriverCommand( null, DriverCommand::NEW_SESSION, array( 'desiredCapabilities' => $desired_capabilities->toArray(), ) ); $response = $this->executor->execute($command); $this->setSessionID($response->getSessionID()); } /** * Always throws an exception. Use ChromeDriver::start() instead. * * @param string $url The url of the remote server * @param DesiredCapabilities $desired_capabilities The desired capabilities * @param int|null $timeout_in_ms * @param int|null $request_timeout_in_ms * * @throws WebDriverException */ public static function create( $url = 'http://localhost:4444/wd/hub', $desired_capabilities = null, $timeout_in_ms = null, $request_timeout_in_ms = null ) { throw new WebDriverException('Please use ChromeDriver::start() instead.'); } /** * Always throws an exception. Use ChromeDriver::start() instead. * * @param string $session_id The existing session id * @param string $url The url of the remote server * * @throws WebDriverException */ public static function createBySessionID( $session_id, $url = 'http://localhost:4444/wd/hub' ) { throw new WebDriverException('Please use ChromeDriver::start() instead.'); } }