コード例 #1
0
 private void throwShouldBePresentErrorWithCauseIfPresent(
     final Throwable timeout, final String defaultMessage) {
   String timeoutMessage =
       (timeout.getCause() != null) ? timeout.getCause().getMessage() : timeout.getMessage();
   String finalMessage =
       (StringUtils.isNotEmpty(timeoutMessage)) ? timeoutMessage : defaultMessage;
   throw new ElementShouldBePresentException(finalMessage, timeout);
 }
コード例 #2
0
 private void checkPresenceOfWebElement() {
   try {
     if (!driverIsDisabled()) {
       waitForCondition().until(elementIsDisplayed());
     }
   } catch (Throwable error) {
     if (webElement != null) {
       throwShouldBeVisibleErrorWithCauseIfPresent(error, error.getMessage());
     } else {
       throwNoSuchElementExceptionWithCauseIfPresent(error, error.getMessage());
     }
   }
 }
コード例 #3
0
 @Override
 public WebElementFacade waitUntilVisible() {
   try {
     if (!driverIsDisabled()) {
       waitForCondition().until(elementIsDisplayed());
     }
   } catch (Throwable error) {
     if (webElement != null) {
       throwShouldBeVisibleErrorWithCauseIfPresent(error, error.getMessage());
     } else {
       throwNoSuchElementExceptionWithCauseIfPresent(error, error.getMessage());
     }
   }
   return this;
 }