public Response execute(RemoteControlPool pool) throws IOException { final RemoteControlProxy remoteControl; final Response response; if (null == sessionId) { return new Response("Selenium Driver error: No sessionId provided for command '" + parameters.toString() + "'"); } remoteControl = pool.retrieve(sessionId()); pool.updateSessionLastActiveAt(sessionId); response = remoteControl.forward(parameters()); pool.updateSessionLastActiveAt(sessionId); return response; }
public Response execute(RemoteControlPool pool) throws IOException { final RemoteControlProxy remoteControl; final Response response; if (null == sessionId) { return new Response("Selenium Driver error: No sessionId provided for command '" + parameters.toString() + "'"); } remoteControl = pool.retrieve(sessionId()); pool.updateSessionLastActiveAt(sessionId); response = remoteControl.forward(parameters()); pool.updateSessionLastActiveAt(sessionId); return response; }
public Response execute(RemoteControlPool pool) throws IOException { RemoteControlProxy remoteControl; final String sessionId; final Response response; remoteControl = pool.reserve(environment); if (null == remoteControl) { final String message = "No available remote control for environment '" + environment.name() + "'"; logger.warn(message); return new Response(message); } try { response = remoteControl.forward(parameters()); sessionId = parseSessionId(response.body()); if (null == sessionId) { pool.release(remoteControl); return new Response("Could not retrieve a new session"); } pool.associateWithSession(remoteControl, sessionId); pool.updateSessionLastActiveAt(sessionId); return response; } catch (Exception e) { logger.error("Problem while requesting new browser session", e); pool.release(remoteControl); return new Response(e.getMessage()); } }
public Response execute(RemoteControlPool pool) throws IOException { RemoteControlProxy remoteControl; final String sessionId; final Response response; remoteControl = pool.reserve(environment); if (null == remoteControl) { final String message = "No available remote control for environment '" + environment.name() + "'"; logger.warn(message); return new Response(message); } try { response = remoteControl.forward(parameters()); sessionId = parseSessionId(response.body()); if (null == sessionId) { pool.release(remoteControl); return new Response("Could not retrieve a new session"); } pool.associateWithSession(remoteControl, sessionId); pool.updateSessionLastActiveAt(sessionId); return response; } catch (Exception e) { logger.error("Problem while requesting new browser session", e); pool.release(remoteControl); return new Response(e.getMessage()); } }