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

  }

  private static void addWaitConditions(CrawljaxConfigurationBuilder crawler) {
    crawler.crawlRules().addWaitCondition(
            new WaitCondition("testWaitCondition.html", 2000, new ExpectedVisibleCondition(
                    new Identification(How.id, "SLOW_WIDGET"))));
  }
View Full Code Here

    }
    return new Point(0, 0);
  }

  private boolean bodyHasOffset(EmbeddedBrowser embeddedBrowser) {
    WebElement body = embeddedBrowser.getWebElement(new Identification(
            How.tag, "body"));
    String position = body.getCssValue("position");
    LOG.debug("Body has CSS position: {}", position);
    return "relative".equals(position);
  }
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

    String newXPath = new ElementResolver(eventable, browser).resolve();
    if (newXPath != null && !xpath.equals(newXPath)) {
      LOG.debug("XPath changed from {} to {} relatedFrame: {}", xpath, newXPath,
              eventable.getRelatedFrame());
      eventToFire =
              new Eventable(new Identification(Identification.How.xpath, newXPath),
                      eventType);
    }
    return eventToFire;
  }
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

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.