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);
}
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);
}
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);
}
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");
}
}
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());
}
}
Aggregations