Package com.crawljax.core.state

Examples of com.crawljax.core.state.Identification


   * .
   */
  @Test
  public final void testIsVisible() {
    assertFalse("Wrong Xpath so not visible",
            browser.isVisible(new Identification(How.xpath, "/RUBISH")));
  }
View Full Code Here


   * .
   */
  @Test
  public final void testGetInputWithRandomValue() {
    assertNull("Wrong Xpath so null as result of InputWithRandomValue",
            browser.getInputWithRandomValue(new FormInput("text", new Identification(
                    How.xpath, "/RUBISH"), "abc")));
  }
View Full Code Here

   * .
   */
  @Test
  public final void testElementExists() {
    assertFalse("Wrong Xpath so element does not exsist",
            browser.elementExists(new Identification(How.xpath, "/RUBISH")));
  }
View Full Code Here

   * .
   */
  @Test
  public final void testGetWebElement() {
    try {
      browser.getWebElement(new Identification(How.xpath, "/RUBISH"));
    } catch (NoSuchElementException e) {
      // Expected behavior
      return;
    }
    Assert.fail("NoSuchElementException should have been thrown");
View Full Code Here

                            new NotXPathCondition("x0"),
                            new NotXPathCondition("x1"),
                            Logic.and(new XPathCondition("x0"))
            },
                    {
                            new VisibleCondition(new Identification(Identification.How.xpath,
                                    "xp0")),
                            new VisibleCondition(new Identification(Identification.How.xpath,
                                    "xp0")),
                            new VisibleCondition(new Identification(Identification.How.tag,
                                    "xp0")),
                            new VisibleCondition(new Identification(Identification.How.xpath,
                                    "xp1"))
            },
                    {
                            new NotVisibleCondition(new Identification(
                                    Identification.How.xpath, "xp")),
                            new NotVisibleCondition(new Identification(
                                    Identification.How.xpath, "xp")),
                            new NotVisibleCondition(new Identification(
                                    Identification.How.tag, "xp")),
                            Logic.and(new VisibleCondition(new Identification(
                                    Identification.How.xpath, "xp")))
            },
                    {
                            new JavaScriptCondition("0"),
                            new JavaScriptCondition("0"),
View Full Code Here

          candidateElements =
                  formHandler.getCandidateElementsForInputs(sourceElement,
                          eventableCondition);
        } else {
          // just add default element
          candidateElements.add(new CandidateElement(sourceElement, new Identification(
                  Identification.How.xpath, xpath), relatedFrame));
        }

        for (CandidateElement candidateElement : candidateElements) {
          if (!clickOnce || checkedElements.markChecked(candidateElement)) {
View Full Code Here

   * @throws Exception
   */
  private Identification getIdentification(Node element) throws Exception {
    NamedNodeMap attributes = element.getAttributes();
    if (attributes.getNamedItem("id") != null) {
      return new Identification(Identification.How.id, attributes.getNamedItem("id")
              .getNodeValue());
    } else if (attributes.getNamedItem("name") != null) {
      return new Identification(Identification.How.name, attributes.getNamedItem("name")
              .getNodeValue());
    }

    // try to find the xpath
    String xpathExpr = XPathHelper.getXPathExpression(element);
    if (xpathExpr != null && !xpathExpr.equals("")) {
      return new Identification(Identification.How.xpath, xpathExpr);
    }

    return null;
  }
View Full Code Here

          int indexValue) {
    return getFormInput(browser, element, indexValue);
  }

  private FormInput getFormInput(EmbeddedBrowser browser, Node element, int indexValue) {
    Identification identification;
    try {
      identification = getIdentification(element);
      if (identification == null) {
        return null;
      }
    } catch (Exception e) {
      return null;
    }
    // CHECK
    String id = fieldMatches(identification.getValue());
    FormInput input = new FormInput();
    input.setType(getElementType(element));
    input.setIdentification(identification);
    Set<InputValue> values = new HashSet<InputValue>();
View Full Code Here

      String newXPath = new ElementResolver(eventable, getBrowser()).resolve();
      if (newXPath != null && !xpath.equals(newXPath)) {
        LOGGER.info("XPath changed from " + xpath + " to " + newXPath + " relatedFrame:"
                + eventable.getRelatedFrame());
        eventable =
                new Eventable(new Identification(Identification.How.xpath, newXPath),
                        eventType);
      }
    }

    if (getBrowser().fireEvent(eventable)) {
View Full Code Here

      // value combination
      candidateElements =
              formHandler.getCandidateElementsForInputs(sourceElement, eventableCondition);
    } else {
      // just add default element
      candidateElements.add(new CandidateElement(sourceElement, new Identification(
              Identification.How.xpath, xpath), relatedFrame));
    }

    for (CandidateElement candidateElement : candidateElements) {
      if (!clickOnce || checkedElements.markChecked(candidateElement)) {
View Full Code Here

TOP

Related Classes of com.crawljax.core.state.Identification

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.