Search in sources :

Example 51 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class MobileNativeClickSnippet method execute.

@Override
public void execute() throws Exception {
    findElement();
    WebElement targetElement = getElement();
    try {
        if (!targetElement.isEnabled()) {
            throw new AutomatorException(ELEMENT_IS_DISABLED);
        }
        targetElement.click();
    } catch (StaleElementReferenceException staleException) {
        log.info("Encountered StaleElementReferenceException");
        handleStaleelementExecptionOnClickAction();
    }
    setSuccessMessage(SUCCESS_MESSAGE);
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) StaleElementReferenceException(org.openqa.selenium.StaleElementReferenceException) WebElement(org.openqa.selenium.WebElement)

Example 52 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class IfElementProxyAction method execute.

@Override
public void execute() throws Exception {
    String status = getTestData();
    switch(status) {
        case ActionConstants.ENABLED:
            VerifyElementEnabledAction enabled = (VerifyElementEnabledAction) this.initializeChildSnippet(VerifyElementEnabledAction.class);
            enabled.execute();
            this.setSuccessMessage(enabled.getSuccessMessage());
            break;
        case ActionConstants.DISABLED:
            VerifyElementDisabledAction disabled = (VerifyElementDisabledAction) this.initializeChildSnippet(VerifyElementDisabledAction.class);
            disabled.execute();
            this.setSuccessMessage(disabled.getSuccessMessage());
            break;
        case ActionConstants.VISIBLE:
            VerifyElementPresenceAction visible = (VerifyElementPresenceAction) this.initializeChildSnippet(VerifyElementPresenceAction.class);
            visible.execute();
            this.setSuccessMessage(visible.getSuccessMessage());
            break;
        case ActionConstants.NOT_VISIBLE:
            VerifyElementAbsenceAction notVisible = (VerifyElementAbsenceAction) this.initializeChildSnippet(VerifyElementAbsenceAction.class);
            notVisible.execute();
            this.setSuccessMessage(notVisible.getSuccessMessage());
            break;
        default:
            setErrorMessage("Unable to Perform Verify Action due to error at test data");
            throw new AutomatorException("Unable to Perform Verify Action due to error at test data");
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) VerifyElementPresenceAction(com.testsigma.automator.actions.mobile.ios.verify.VerifyElementPresenceAction) VerifyElementEnabledAction(com.testsigma.automator.actions.mobile.ios.verify.VerifyElementEnabledAction) VerifyElementAbsenceAction(com.testsigma.automator.actions.mobile.ios.verify.VerifyElementAbsenceAction) VerifyElementDisabledAction(com.testsigma.automator.actions.mobile.ios.verify.VerifyElementDisabledAction)

Example 53 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class AlertVisibilityStatusAction method execute.

@Override
public void execute() throws Exception {
    String status = getTestData();
    switch(status) {
        case ActionConstants.NOT_VISIBLE:
            VerifyAlertAbsenceAction absence = (VerifyAlertAbsenceAction) this.initializeChildSnippet(VerifyAlertAbsenceAction.class);
            absence.execute();
            this.setSuccessMessage(absence.getSuccessMessage());
            break;
        case ActionConstants.VISIBLE:
            VerifyAlertPresenceAction available = (VerifyAlertPresenceAction) this.initializeChildSnippet(VerifyAlertPresenceAction.class);
            available.execute();
            this.setSuccessMessage(available.getSuccessMessage());
            break;
        default:
            setErrorMessage("Unable to Perform Alert Visibility Action due to error at test data");
            throw new AutomatorException("Unable to Perform Alert Visibility Action due to error at test data");
    }
}
Also used : VerifyAlertPresenceAction(com.testsigma.automator.actions.mobile.ios.alert.VerifyAlertPresenceAction) AutomatorException(com.testsigma.automator.exceptions.AutomatorException) VerifyAlertAbsenceAction(com.testsigma.automator.actions.mobile.ios.alert.VerifyAlertAbsenceAction)

Example 54 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class WaitUntilAllImagesAreLoadedAction method execute.

@Override
protected void execute() throws Exception {
    try {
        constructElementWithDynamicXpath("//XCUIElementTypeImage", TESTS_TEP_DATA_MAP_KEY_ELEMENT, null, null, false);
        // ExpectedConditions.visibilityOfElements always fails ..bcz in IOS element.isDisplayed() for images is always returning false.
        List<WebElement> elements = getWebDriverWait().until(CustomExpectedConditions.allElementsAreEnabled(getBy()));
        Assert.notNull(elements, FAILURE_MESSAGE);
        setSuccessMessage(SUCCESS_MESSAGE);
    } catch (TimeoutException e) {
        throw new AutomatorException(FAILURE_MESSAGE, (Exception) e.getCause());
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) WebElement(org.openqa.selenium.WebElement) AutomatorException(com.testsigma.automator.exceptions.AutomatorException) TimeoutException(org.openqa.selenium.TimeoutException) TimeoutException(org.openqa.selenium.TimeoutException)

Example 55 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class MobileNativeWaitUntilAlertIsVisibleAction method execute.

@Override
public void execute() throws Exception {
    try {
        getWebDriverWait().until(ExpectedConditions.visibilityOfElementLocated(getBy()));
        verifyAlertPresence(FAILURE_NO_ALERT);
    } catch (TimeoutException e) {
        throw new AutomatorException(String.format(FAILURE_MESSAGE, getTimeout()), (Exception) e.getCause());
    }
    setSuccessMessage(SUCCESS_MESSAGE);
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) AutomatorException(com.testsigma.automator.exceptions.AutomatorException) TimeoutException(org.openqa.selenium.TimeoutException) TimeoutException(org.openqa.selenium.TimeoutException)

Aggregations

AutomatorException (com.testsigma.automator.exceptions.AutomatorException)119 TimeoutException (org.openqa.selenium.TimeoutException)31 WebElement (org.openqa.selenium.WebElement)19 IOException (java.io.IOException)12 ArrayList (java.util.ArrayList)9 Select (org.openqa.selenium.support.ui.Select)6 TestsigmaException (com.testsigma.agent.exception.TestsigmaException)5 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 RuntimeDataProvider (com.testsigma.automator.utilities.RuntimeDataProvider)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 Map (java.util.Map)3 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)3 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)3 PathNotFoundException (com.jayway.jsonpath.PathNotFoundException)2 ElementNotDisplayedException (com.testsigma.automator.actions.exceptions.ElementNotDisplayedException)2 MobileApp (com.testsigma.automator.mobile.MobileApp)2 ObjectMapperService (com.testsigma.automator.service.ObjectMapperService)2 ErrorUtil (com.testsigma.automator.utilities.ErrorUtil)2 File (java.io.File)2 MalformedURLException (java.net.MalformedURLException)2