Package net.sourceforge.jwebunit.api

Examples of net.sourceforge.jwebunit.api.IElement


   
    // make sure the link exists, first
    assertLinkPresentWithExactText(pageText);
   
    // now find the link, and get where it goes to
    IElement element = getElementByXPath("//a[normalize-space(text()) = normalize-space('" + pageText + "')]");   
    String href = element.getAttribute("href");
    assertNotNull(href);
   
    // construct the url
    String url = getOutputRoot().getProjectRelativePath().toString()
       + "/"
View Full Code Here


   * @return
   */
  protected IElement getFieldForLabel(String labelText) {
    List<IElement> list = hasLabelForText(labelText);
    assertEquals(1, list.size());
    IElement label = list.get(0);
   
    List<IElement> forFields = getFieldsForLabel(label);
    assertEquals(1, forFields.size());
    return forFields.get(0);   
  }
View Full Code Here

   * @return
   */
  protected String getLabelIDForText(String text) {
    List<IElement> elements = hasLabelForText(text);
    assertEquals("Too many labels found for text '" + text + "'", 1, elements.size());
    IElement element = elements.get(0);
    String id = element.getAttribute("id");
    assertNotNull("Label ID for text '" + text + "' was null", id);
    return id;
  }
View Full Code Here

   * @param notText
   * @return
   */
  protected String getLabelIDForText(String text, String notText) {
    logTimed("web", "internal", "get label ID for text (2)");
    IElement element = getElementByXPath("//label[" + getContainsTextXPath(text) + " and not(" + getContainsTextXPath(notText) + ")]");
    logTimed("web", "internal", "get label ID for text (2) complete");
    return element.getAttribute("id");
  }
View Full Code Here

   * @param notText
   * @return
   */
  protected String getLabelIDForText(String text, String notText, String alsoCondition) {
    logTimed("web", "internal", "get label ID for text (3)");
    IElement element = getElementByXPath("//label[" + getContainsTextXPath(text) + " and not(" + getContainsTextXPath(notText) + ") and (" + alsoCondition + ")]");
    logTimed("web", "internal", "get label ID for text (3) complete");
    return element.getAttribute("id");
  }
View Full Code Here

   *
   * @see #getLabelIDForText(String)
   * @param text label text to search for
   */
  protected void assertLabelNotPresent(String text) {
    IElement element;
    try {
      element = getElementByXPath("//label[contains(text(),'" + text + "')]");
    } catch (AssertionFailedError e) {
      // expected
      element = null;
View Full Code Here

   * Reset the debug dialog text, improving the accuracy of methods
   * like {@link #assertNoProblem()}.
   */
  public void resetDebug() {
    if (hasElementById("debug")) {
      IElement debug = getElementById("debug");
      debug.setTextContent("");
    }
    if (hasElementById("response")) {
      IElement debug = getElementById("response");
      debug.setTextContent("");
    }
  }
View Full Code Here

   *
   * @return the debug dialog text, or <code>null</code> if no debug dialog exists
   */
  public String getDebugText() {
    if (hasElementById("debug")) {
      IElement debug = getElementById("debug");
      return debug.getTextContent();
    }
    return null;
  }
View Full Code Here

   * @return the Label found with the given text.
   */
  public IElement assertLabelTextPresent(String text) {
    assertFalse("Cannot assert the presence of an empty label", text.isEmpty());
   
    IElement match = getElementByXPath("//label[" + getContainsTextXPath(text) + "]");
    assertNotNull(match);
    String textContent = match.getTextContent();
    // normalise
    textContent = normalizeSpace(textContent);
    assertEquals(text, textContent);
    return match;
  }
View Full Code Here

   *
   * @param text
   * @return the Label found with the given text.
   */
  public IElement assertLabelTextExactlyPresent(String text) {
    IElement match = getElementByXPath("//label[" + getExactTextXPath(text) + "]");
    assertNotNull(match);
    String textContent = match.getTextContent();
    // normalise
    textContent = normalizeSpace(textContent);
    assertEquals(text, textContent);
   
    // make sure it's visible
View Full Code Here

TOP

Related Classes of net.sourceforge.jwebunit.api.IElement

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.