Search in sources :

Example 76 with AutomatorException

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

the class SubmitFormAndSwitchToNewWindowAction method execute.

@Override
protected void execute() throws Exception {
    List<String> oldWindowsList = getWindowHandles();
    findElement();
    try {
        getElement().submit();
        List<String> newWindowsList = getWindowHandles();
        Assert.isTrue((oldWindowsList.size() < newWindowsList.size()), String.format(FAILURE_NEW_WINDOW_NOT_OPENED, getFindByType(), getLocatorValue()));
        getDriver().switchTo().window(newWindowsList.get(newWindowsList.size() - 1));
    } catch (Exception e) {
        throw new AutomatorException(String.format(FAILURE_NOT_SUBMITTED, getFindByType(), getLocatorValue()));
    }
    setSuccessMessage(SUCCESS_MESSAGE);
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) AutomatorException(com.testsigma.automator.exceptions.AutomatorException)

Example 77 with AutomatorException

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

the class WaitUntilElementIsNotSelectedSnippet method execute.

@Override
public void execute() throws Exception {
    findElement();
    try {
        getWebDriverWait().until(ExpectedConditions.attributeContains(getElement(), "selected", "false"));
    } catch (TimeoutException e) {
        throw new AutomatorException(String.format(FAILURE_MESSAGE, getFindByType(), getLocatorValue()), (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)

Example 78 with AutomatorException

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

the class WaitUntilElementIsSelectedSnippet method execute.

@Override
public void execute() throws Exception {
    findElement();
    try {
        getWebDriverWait().until(ExpectedConditions.attributeContains(getElement(), "selected", "true"));
    } catch (TimeoutException e) {
        throw new AutomatorException(String.format(FAILURE_MESSAGE, getFindByType(), getLocatorValue()), (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)

Example 79 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:
            VerifyDisabledAction disabled = (VerifyDisabledAction) this.initializeChildSnippet(VerifyDisabledAction.class);
            disabled.execute();
            this.setSuccessMessage(disabled.getSuccessMessage());
            break;
        case ActionConstants.VISIBLE:
            VerifyElementPresentAction visible = (VerifyElementPresentAction) this.initializeChildSnippet(VerifyElementPresentAction.class);
            visible.execute();
            this.setSuccessMessage(visible.getSuccessMessage());
            break;
        case ActionConstants.NOT_VISIBLE:
            VerifyElementIsNotDisplayedAction notVisible = (VerifyElementIsNotDisplayedAction) this.initializeChildSnippet(VerifyElementIsNotDisplayedAction.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) VerifyElementIsNotDisplayedAction(com.testsigma.automator.actions.mobile.mobileweb.verify.VerifyElementIsNotDisplayedAction) VerifyElementEnabledAction(com.testsigma.automator.actions.mobile.mobileweb.verify.VerifyElementEnabledAction) VerifyDisabledAction(com.testsigma.automator.actions.mobile.mobileweb.verify.VerifyDisabledAction) VerifyElementPresentAction(com.testsigma.automator.actions.mobile.mobileweb.verify.VerifyElementPresentAction)

Example 80 with AutomatorException

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

the class WaitUntilTextDisplayedAction method execute.

@Override
public void execute() throws Exception {
    try {
        boolean textPresent = getWebDriverWait().until(CustomExpectedConditions.mobileTextToBePresent(getTestData()));
        Assert.isTrue(textPresent, String.format(FAILURE_MESSAGE, getTimeout(), getTestData()));
        setSuccessMessage(SUCCESS_MESSAGE);
    } catch (TimeoutException e) {
        throw new AutomatorException(String.format(FAILURE_MESSAGE, getTimeout(), getTestData()), (Exception) e.getCause());
    }
}
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