Search in sources :

Example 6 with MobileAutomationServerCommandExecutionException

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);
    }
}
Also used : ActionResult(com.testsigma.automator.constants.ActionResult) RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver) ArrayList(java.util.ArrayList) List(java.util.List) MobileAutomationServerCommandExecutionException(com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException) MobileAutomationServerCommandExecutionException(com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException)

Example 7 with MobileAutomationServerCommandExecutionException

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);
    }
}
Also used : ActionResult(com.testsigma.automator.constants.ActionResult) RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver) MobileAutomationServerCommandExecutionException(com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException) MobileAutomationServerCommandExecutionException(com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException)

Example 8 with MobileAutomationServerCommandExecutionException

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());
    }
}
Also used : ActionResult(com.testsigma.automator.constants.ActionResult) SwitchToNativeAppContextAction(com.testsigma.automator.actions.mobile.android.switchactions.SwitchToNativeAppContextAction) MobileAutomationServerCommandExecutionException(com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException)

Example 9 with MobileAutomationServerCommandExecutionException

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);
    }
}
Also used : MobileAutomationServerCommandExecutionException(com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException) MobileAutomationServerCommandExecutionException(com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException)

Example 10 with MobileAutomationServerCommandExecutionException

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);
    }
}
Also used : MobileAutomationServerCommandExecutionException(com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException) MobileAutomationServerCommandExecutionException(com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException)

Aggregations

MobileAutomationServerCommandExecutionException (com.testsigma.agent.exception.MobileAutomationServerCommandExecutionException)15 ActionResult (com.testsigma.automator.constants.ActionResult)12 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)11 com.testsigma.automator.actions.mobile (com.testsigma.automator.actions.mobile)2 ArrayList (java.util.ArrayList)2 ScreenDimensions (com.testsigma.agent.dto.ScreenDimensions)1 SwitchToNativeAppContextAction (com.testsigma.automator.actions.mobile.android.switchactions.SwitchToNativeAppContextAction)1 List (java.util.List)1 Dimension (org.openqa.selenium.Dimension)1