Package com.canoo.webtest.engine

Examples of com.canoo.webtest.engine.StepFailedException


    return elt instanceof HtmlHiddenInput;
  }

  protected void setField(final HtmlElement field) {
    if (!(field instanceof HtmlInput)) {
      throw new StepFailedException("Found " + field.getTagName() + " when looking for input", this);
    }
    ((HtmlInput) field).setValueAttribute(getValue());
    LOG.debug("Set hidden input field " + field + " to value " + getValue());
  }
View Full Code Here


        && (getValue() == null || verifyStrings(getValue(), curOption.getValueAttribute()))) {
        LOG.debug("Found corresponding option " + curOption);
        if (curOption.isSelected()) {
          return;
        }
        throw new StepFailedException(getStepLabel() + ": " + buildFailMessage(getValue()), this);
      }
    }

    // if we reach here, we haven't found anything
    throw new StepFailedException("Select option \"" + fText + " : " + getValue()
      + "\" not found for inputfield: <" + getName() + ">",
      this);
  }
View Full Code Here

    final XPathHelper xpathHelper = getContext().getXPathHelper();

    if (isComparingPathAndValue()) {
      final String actualValue = xpathHelper.stringValueOf(currentResponse, getXpath());
      if (!verifyText(actualValue)) {
        throw new StepFailedException("Wrong result for xpath >" + fXpath + "<", getText(), actualValue, this);
      }
    }
    else
    {
      final Object singleNode = xpathHelper.selectFirst(currentResponse, getXpath());
      if (singleNode == null) {
        throw new StepFailedException("xpath test: " + fXpath + " matched no nodes", this);
      }
      else if (Boolean.FALSE.equals(singleNode))
      {
        throw new StepFailedException("xpath test: " + fXpath + " evaluates to false", this);
      }
    }
  }
View Full Code Here

    fTableLocator = tableLocator;
  }

   public void doExecute() throws Exception {
        if (!isExpectedStringPresent()) {
      throw new StepFailedException(getStepLabel() + ": " + getFailedMessage(), this);
    }
  }
View Full Code Here

        return verifyText(text);
      }
      return text.indexOf(getText()) > -1;
    }
        catch (TableNotFoundException tnf) {
      throw new StepFailedException("Cannot find table: " + tnf.toString(), this);
    }
        catch (IndexOutOfBoundsException ioobe) {
      throw new StepFailedException("Cannot find cell with supplied index in table", this);
    }
  }
View Full Code Here

  }

  protected void verifyField(final HtmlElement element) {
    HtmlRadioButtonInput radioButton = (HtmlRadioButtonInput) element;
    if (radioButton.isChecked() != ConversionUtil.convertToBoolean(getChecked(), false)) {
      throw new StepFailedException("RadioButton is " + (radioButton.isChecked() ? "" : "not") + "checked!", this);
    }
  }
View Full Code Here

    final Context context = getContext();
    final HtmlPage currentResponse;
    try {
      currentResponse = (HtmlPage) context.getCurrentResponse();
    } catch (ClassCastException cce) {
      throw new StepFailedException("Current response is not an html page but " + context.getCurrentResponse().getClass(), this);
    }

    final StringBuffer sb = verifyLinksOnPage(currentResponse);

    if (sb.length() > 0) {
      sb.insert(0, currentResponse.getWebResponse().getRequestUrl().toExternalForm() + ":" + LINE_SEPARATOR);
      throw new StepFailedException(sb.toString(), this);
    }
  }
View Full Code Here

  protected void verifyField(final HtmlElement field) throws IOException {
    final HtmlInput input = (HtmlInput) field;
    final String fieldContents = input.getValueAttribute();
    if (!verifyStrings(getValue(), fieldContents, getRegex())) {
      throw new StepFailedException("Wrong contents found in input field: " + input, getValue(), fieldContents);
    }

  }
View Full Code Here

    public void doExecute() {
        final WebResponse response = getContext().getCurrentResponse().getWebResponse();
        final String headerValue = response.getResponseHeaderValue(fHeaderName);

        if (headerValue == null) {
            throw new StepFailedException("Header \"" + fHeaderName + "\" not set!", this);
        }
        storeProperty(headerValue, getName());
    }
View Full Code Here

    public void doExecute() {
        final Cookie[] cookies = getCookies(getContext());
        LOG.debug("Found " + cookies.length + " cookie(s)");
        if (cookies.length == 0) {
            throw new StepFailedException("No cookies set!", this);
        }
        final Cookie cookie = findCookie(cookies);
        if (cookie == null)
            throw new StepFailedException("Cookie \"" + fCookieName + "\" not set!", this);
        else
        {
          storeProperty(cookie.getValue(), getName());
          fCookieValue = cookie.getValue();
        }
View Full Code Here

TOP

Related Classes of com.canoo.webtest.engine.StepFailedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.