use of org.openqa.selenium.TimeoutException in project testsigma by testsigmahq.
the class CurrentWebPageLoadingStatusAction method execute.
@Override
public void execute() throws Exception {
String status = getTestData();
switch(status) {
case ActionConstants.LOADED:
try {
boolean pageLoaded = getWebDriverWait().until(CustomExpectedConditions.waitForPageLoadUsingJS());
Assert.isTrue(pageLoaded, LOADED_FAILURE_MESSAGE);
setSuccessMessage(LOADED_SUCCESS_MESSAGE);
break;
} catch (TimeoutException e) {
throw new AutomatorException(LOADED_FAILURE_MESSAGE, (Exception) e.getCause());
}
case ActionConstants.NOT_LOADED:
try {
boolean pageLoaded = getWebDriverWait().until(CustomExpectedConditions.waitForPageLoadUsingJS());
Assert.isTrue(!pageLoaded, NOT_LOADED_ERROR_MESSAGE);
setSuccessMessage(NOT_LOADED_SUCCESS_MESSAGE);
break;
} catch (TimeoutException e) {
throw new AutomatorException(NOT_LOADED_ERROR_MESSAGE, (Exception) e.getCause());
}
}
}
use of org.openqa.selenium.TimeoutException in project testsigma by testsigmahq.
the class WaitUntilFileDownloadIsCompleteAction method execute.
@Override
public void execute() throws Exception {
getDriver().navigate().to("chrome://downloads");
try {
String chromeJavaScript = "var tag = document.querySelector('downloads-manager').shadowRoot;" + " var item_tags = tag.querySelectorAll('downloads-item');" + " var item_tags_length = item_tags.length;" + " var progress_lst = [];" + " for(var i=0; i<item_tags_length; i++) {" + " var intag = item_tags[i].shadowRoot;" + " var progress_tag = intag.getElementById('progress');" + " var progress = null;" + " if(progress_tag && progress_tag.value < 100) {" + " progress = progress_tag.value;" + " }" + " if(progress!=null) progress_lst.push(progress);" + " }" + " return progress_lst";
// We create a custom wait with long sleep time. Since we are only allowing max of 120 secs for step level timeout(which
// may not be sufficient for some downloads), we will be giving additional timeout here.
WebDriverWait waiter = new WebDriverWait(getDriver(), 600, 5000);
boolean isDownloadComplted = waiter.until(CustomExpectedConditions.downloadToBeCompletedInChrome(chromeJavaScript));
Assert.isTrue(isDownloadComplted, String.format(FAILURE_MESSAGE, 600));
setSuccessMessage(SUCCESS_MESSAGE);
} catch (TimeoutException e) {
throw new AutomatorException(String.format(FAILURE_MESSAGE, 600), (Exception) e.getCause());
} finally {
getDriver().navigate().back();
}
}
use of org.openqa.selenium.TimeoutException in project testsigma by testsigmahq.
the class WaitUntilElementHasValueAction method execute.
@Override
protected void execute() throws Exception {
try {
boolean valueMatching = getWebDriverWait().until(ExpectedConditions.textToBePresentInElementValue(getBy(), getTestData()));
Assert.isTrue(valueMatching, String.format(FAILURE_MESSAGE, getFindByType(), getLocatorValue(), getTimeout(), getTestData()));
setSuccessMessage(SUCCESS_MESSAGE);
} catch (TimeoutException e) {
throw new AutomatorException(String.format(FAILURE_MESSAGE, getFindByType(), getLocatorValue(), getTimeout(), getTestData()), (Exception) e.getCause());
}
}
use of org.openqa.selenium.TimeoutException in project testsigma by testsigmahq.
the class WaitUntilElementIsClickableAction method execute.
@Override
public void execute() throws Exception {
try {
WebElement visibleElement = getWebDriverWait().until(ExpectedConditions.elementToBeClickable(getBy()));
Assert.notNull(visibleElement, String.format(FAILURE_MESSAGE, getFindByType(), getLocatorValue(), getTimeout()));
setSuccessMessage(SUCCESS_MESSAGE);
} catch (TimeoutException e) {
throw new AutomatorException(String.format(FAILURE_MESSAGE, getFindByType(), getLocatorValue(), getTimeout()), (Exception) e.getCause());
}
}
use of org.openqa.selenium.TimeoutException in project testsigma by testsigmahq.
the class WaitUntilElementIsDisabledAction method execute.
@Override
public void execute() throws Exception {
try {
boolean elementDisabled = getWebDriverWait().until(CustomExpectedConditions.elementIsDisabled(getBy()));
Assert.isTrue(elementDisabled, String.format(FAILURE_MESSAGE, getFindByType(), getLocatorValue(), getTimeout()));
setSuccessMessage(SUCCESS_MESSAGE);
} catch (TimeoutException e) {
throw new AutomatorException(String.format(FAILURE_MESSAGE, getFindByType(), getLocatorValue(), getTimeout()), (Exception) e.getCause());
}
}
Aggregations