use of com.testsigma.agent.dto.DriverSessionDTO in project testsigma by testsigmahq.
the class DriverSessionsController method createSession.
/**
* Create a remote web driver session using selenium/appium
*
* @param driverSessionRequest
* @return created remote web driver sessionId
* @throws Exception
*/
@PostMapping
@ResponseBody
public DriverSessionDTO createSession(@RequestBody DriverSessionRequest driverSessionRequest) throws Exception {
log.debug("Creating a remote web driver session for - " + driverSessionRequest.getUniqueId() + " ( " + driverSessionRequest + ") ");
if (driverSessionRequest.getMobileSessionId() != null) {
try {
String sessionId = driverSessionsService.createSession(driverSessionRequest);
DriverSessionDTO driverSessionDTO = new DriverSessionDTO();
driverSessionDTO.setSessionId(sessionId);
driverSessionDTO.setHostname(AgentService.getComputerName());
return driverSessionDTO;
} catch (IOException e) {
log.error(e.getMessage(), e);
throw new AutomatorException(e.getMessage(), e);
}
} else {
throw new TestsigmaException("Failed creating driver session: mobileSessionId is NULL");
}
}
use of com.testsigma.agent.dto.DriverSessionDTO in project testsigma by testsigmahq.
the class DriverSessionsController method getSession.
/**
* get the status of a remote web driver session
*
* @param sessionId
* @return session status
* @throws Exception
*/
@GetMapping(value = "/{sessionId}")
public DriverSessionDTO getSession(@PathVariable("sessionId") String sessionId) throws Exception {
log.debug("Getting remote web driver session details with session Id- " + sessionId);
String sessionStatus = driverSessionsService.getSession(sessionId);
DriverSessionDTO driverSessionDTO = new DriverSessionDTO();
driverSessionDTO.setSessionId(sessionId);
driverSessionDTO.setStatus(sessionStatus);
return driverSessionDTO;
}
Aggregations