use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class ScrollInsideElementToBottomAction method execute.
@Override
public void execute() throws Exception {
findElement();
try {
WebElement webElement = getElement();
JavascriptExecutor js = (JavascriptExecutor) getDriver();
js.executeScript("arguments[0].scrollTo(0,arguments[0].scrollHeight);", webElement);
} catch (Exception e) {
log.error("unable to sctoll inside an element", e);
throw new AutomatorException(String.format(FAILURE_MESSAGE, getFindByType(), getLocatorValue()));
}
setSuccessMessage(SUCCESS_MESSAGE);
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class SelectMultipleOptionByIndexAction method execute.
@Override
protected void execute() throws Exception {
findElement();
Select selectElement = new Select(getElement());
List<Integer> multipleOptions = getIntegerArray();
for (int i = 0; i < multipleOptions.size(); i++) {
Integer multipleValue = multipleOptions.get(i);
selectByIndex(selectElement, multipleValue);
selectedIndexList.add(multipleValue);
}
List<WebElement> webElements = selectElement.getAllSelectedOptions();
if (webElements.size() < multipleOptions.size()) {
List<String> selectedIndex = new ArrayList<>();
for (WebElement webElement : webElements) {
selectedIndex.add(webElement.getText());
}
throw new AutomatorException(String.format(ELEMENTS_MISMATCHED, getTestData(), getFindByType(), getLocatorValue(), selectedIndex));
}
setSuccessMessage(SUCCESS_MESSAGE);
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class SelectOptionByIndexAction method execute.
@Override
protected void execute() throws Exception {
findElement();
Select selectElement = new Select(getElement());
try {
selectElement.selectByIndex(NumberFormatter.getIntegerValue(getTestData(), String.format(ELEMENT_IS_NOT_A_NUMBER, getTestData())));
setSuccessMessage(SUCCESS_MESSAGE);
} catch (Exception e) {
throw new AutomatorException(String.format(FAILURE_MESSAGE, getTestData(), getFindByType(), getLocatorValue(), getTestData()));
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class SelectOptionByValueAction method execute.
@Override
protected void execute() throws Exception {
findElement();
Select selectElement = new Select(getElement());
try {
selectElement.selectByValue(getTestData());
setSuccessMessage(SUCCESS_MESSAGE);
} catch (NoSuchElementException e) {
throw new AutomatorException(String.format(FAILURE_MESSAGE, getTestData(), getFindByType(), getLocatorValue(), getTestData()));
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class SelectOptionByVisibleTextAction method execute.
@Override
protected void execute() throws Exception {
try {
findElement();
Select selectElement = new Select(getElement());
selectElement.selectByVisibleText(getTestData());
setSuccessMessage(SUCCESS_MESSAGE);
} catch (NoSuchElementException e) {
throw new AutomatorException(String.format(FAILURE_MESSAGE, getTestData(), getFindByType(), getLocatorValue(), getTestData()));
}
}
Aggregations