Package com.canoo.webtest.engine

Examples of com.canoo.webtest.engine.StepFailedException


      if (getName() != null)
        sb.append("name >" + getName() + "< ");
      if (getType() != null)
        sb.append("type >" + getType() + "< ");
      sb.append("(matchCase: " + getMatchCase() + ")");
      throw new StepFailedException(sb.toString(), this);
    }
View Full Code Here


  public void doExecute() throws IOException {
    if (getName() != null) {
      final HtmlForm form = findForm();
      if (form == null) {
        throw new StepFailedException("No suitable form found having field named \"" + getName() + "\"", this);
      }
      verifyField(AbstractSetFieldStep.selectField(findFields(form), getFieldIndex(), this));
    }
    else {
      verifyField(StoreElementAttribute.findElement(getContext().getCurrentResponse(), getHtmlId(), getXpath(), LOG, this));
View Full Code Here

          sb.append(getKey());
          sb.append("\" should ");
          if (!exists)
            sb.append("not ");
          sb.append("exist");
        throw new StepFailedException(sb.toString(), this);
      }
    }
    else
    {
      final boolean regex = ConversionUtil.convertToBoolean(getRegex(), false);
      if (!getVerifier(regex).verifyStrings(getValue(), actualValue)) {
        throw new StepFailedException("Wrong encrypt property value for key \"" + getKey() + "\"", getValue(), actualValue);
      }
    }
  }
View Full Code Here

  }

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

    public void doExecute() {
        int numberOfHits = getNumberOfHits();

        if (numberOfHits > 1) {
            throw new StepFailedException("More than 1 element with type \""
                    + fType + "\" and name \"" + getText() + "\" found!", this);
        }
        if (numberOfHits == 0) {
            throw new StepFailedException("No element of type \"" + fType
                    + "\" and name \"" + getText() + "\" found!", this);
        }
    }
View Full Code Here

    private MessageDigest tryGetDigest() {
        try {
            return MessageDigest.getInstance(getType() == null ? "SHA-1" : getType());
        }
        catch (final NoSuchAlgorithmException e) {
            throw new StepFailedException("No such message digest algorithm '" + getType() + "' available.", this);
        }
    }
View Full Code Here

      fields = pdfPage.getFields(getName(), getPage(), PDFField.TEXTBOX);

    if (getExists() != null) {
      boolean exists = ConversionUtil.convertToBoolean(getExists(), true);
      if (exists && fields.isEmpty())
        throw new StepFailedException("No field found with name \"" + getName() + "\"");
      else if (!exists && !fields.isEmpty())
        throw new StepFailedException(fields.size() + " fields found with name \"" + getName() + "\"");
    }
    else
    {
      if (fields.isEmpty())
      {
              throw new StepFailedException("No text field named '" + getName() + "' found.");
      }
      boolean regex = ConversionUtil.convertToBoolean(getRegex(), false);
      final IStringVerifier verifier = getVerifier(regex);
      for (final Iterator iter = fields.iterator(); iter.hasNext();) {
        final PDFField field = (PDFField) iter.next();
        if (!verifier.verifyStrings(getValue(), field.getValue()))
          throw new StepFailedException("Wrong field value", getValue(), field.getValue());
      }
    }
  }
View Full Code Here

            HtmlPage lastHtmlResp = (HtmlPage) currentResp;
            final HtmlElement element = lastHtmlResp.getHtmlElementById(id);
            log.debug("found element with id \"" + id + "\": " + element);
            return element;
        } catch (final ElementNotFoundException e) {
            throw new StepFailedException("No element found with id \"" + id + "\".", step);
        }
    }
View Full Code Here

  }

  protected void verifyPdf(final PDFPage pdfPage) {
    final String actualTitle = pdfPage.getDocumentTitle();
    if (!getVerifier(getRegex()).verifyStrings(getTitle(), actualTitle)) {
      throw new StepFailedException("Wrong document title", getTitle(), actualTitle);
    }
  }
View Full Code Here

        log.debug("Looking for element with xpath \"" + xpathStr + "\"");
        Object node;
        node = HtmlUnitBoundary.trySelectSingleNodeByXPath(xpathStr, currentResp, step);

        if (node == null) {
            throw new StepFailedException("No element found with xpath \"" + xpathStr + "\".", step);
        }

        try {
            return (HtmlElement) node;
        } catch (ClassCastException cce) {
            throw new StepFailedException("The xpath doesn't select an Element: '" + node.getClass() + "'");
        }

    }
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.