use of com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException in project testsigma by testsigmahq.
the class DriverSessionCommand method findElements.
public List<MobileElement> findElements(String sessionId, Platform platform, ElementSearchCriteria elementSearchCriteria) throws MobileAutomationServerCommandExecutionException {
try {
RemoteWebDriver remoteWebDriver = sessionContainer.getSessionMap().get(sessionId);
FindElementsAction findElementsAction = new FindElementsAction();
findElementsAction.setDriver(remoteWebDriver);
findElementsAction.setPlatform(platform);
findElementsAction.setElementSearchCriteria(elementSearchCriteria);
ActionResult result = findElementsAction.run();
if (result.equals(ActionResult.FAILED)) {
log.error(findElementsAction.getErrorMessage());
throw new Exception("Failed to fetch searched elements " + " : " + findElementsAction.getErrorMessage());
}
return (List<MobileElement>) findElementsAction.getActualValue();
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new MobileAutomationServerCommandExecutionException(e.getMessage(), e);
}
}
use of com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException in project testsigma by testsigmahq.
the class DriverSessionCommand method back.
public void back(String sessionId) throws MobileAutomationServerCommandExecutionException {
try {
RemoteWebDriver remoteWebDriver = sessionContainer.getSessionMap().get(sessionId);
MobileNavigateBackAction mobileNavigateBackAction = new MobileNavigateBackAction();
mobileNavigateBackAction.setDriver(remoteWebDriver);
ActionResult result = mobileNavigateBackAction.run();
if (result.equals(ActionResult.FAILED)) {
log.error(mobileNavigateBackAction.getErrorMessage());
throw new Exception("Failed to navigate back to the previous page " + " : " + mobileNavigateBackAction.getErrorMessage());
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new MobileAutomationServerCommandExecutionException(e.getMessage(), e);
}
}
use of com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException in project testsigma by testsigmahq.
the class DriverSessionCommand method switchToNativeContext.
private void switchToNativeContext(RemoteWebDriver remoteWebDriver, MobileElement mobileElement) throws Exception {
SwitchToNativeAppContextAction switchToContext = new SwitchToNativeAppContextAction();
switchToContext.setDriver(remoteWebDriver);
ActionResult result = switchToContext.run();
if (ActionResult.FAILED.equals(result)) {
log.error(switchToContext.getErrorMessage());
throw new MobileAutomationServerCommandExecutionException("Failed to Switch to back to native context " + " : " + switchToContext.getErrorMessage());
}
}
use of com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException in project testsigma by testsigmahq.
the class DeviceCommand method tap.
public void tap(String uniqueId, TapPoint tapPoint) throws MobileAutomationServerCommandExecutionException {
try {
MobileDevice mobileDevice = deviceContainer.getDevice(uniqueId);
commandExecutor.executeCommand(mobileDevice.iDevice, "input tap " + tapPoint.getX() + " " + tapPoint.getY());
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new MobileAutomationServerCommandExecutionException(e.getMessage(), e);
}
}
use of com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException in project testsigma by testsigmahq.
the class DeviceCommand method swipe.
public void swipe(String uniqueId, TapPoint[] tapPoints) throws MobileAutomationServerCommandExecutionException {
try {
MobileDevice mobileDevice = deviceContainer.getDevice(uniqueId);
commandExecutor.executeCommand(mobileDevice.iDevice, "input swipe " + tapPoints[0].getX() + " " + tapPoints[0].getY() + " " + tapPoints[1].getX() + " " + tapPoints[1].getY());
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new MobileAutomationServerCommandExecutionException(e.getMessage(), e);
}
}
Aggregations