Examples of Identification


Examples of com.crawljax.core.state.Identification

   *            the element
   * @param xpath
   *            the xpath expression of the element
   */
  public CandidateElement(Element element, String xpath, List<FormInput> formInputs) {
    this(element, new Identification(Identification.How.xpath, xpath), "", formInputs);
  }
View Full Code Here

Examples of com.crawljax.core.state.Identification

      }
    }

    private Condition getConditionFromConfig(com.crawljax.web.model.Condition c) {
      Condition condition = null;
      Identification id = null;
      switch (c.getCondition()) {
        case url:
          condition = new UrlCondition(c.getExpression());
          break;
        case notUrl:
          condition = new NotUrlCondition(c.getExpression());
          break;
        case javascript:
          condition = new JavaScriptCondition(c.getExpression());
          break;
        case regex:
          condition = new RegexCondition(c.getExpression());
          break;
        case notRegex:
          condition = new NotRegexCondition(c.getExpression());
          break;
        case visibleId:
          id = new Identification(How.id, c.getExpression());
          condition = new VisibleCondition(id);
          break;
        case notVisibleId:
          id = new Identification(How.id, c.getExpression());
          condition = new NotVisibleCondition(id);
          break;
        case visibleText:
          id = new Identification(How.text, c.getExpression());
          condition = new VisibleCondition(id);
          break;
        case notVisibleText:
          id = new Identification(How.text, c.getExpression());
          condition = new NotVisibleCondition(id);
          break;
        case visibleTag:
          id = new Identification(How.tag, c.getExpression());
          condition = new VisibleCondition(id);
          break;
        case notVisibleTag:
          id = new Identification(How.tag, c.getExpression());
          condition = new NotVisibleCondition(id);
          break;
        case xPath:
          condition = new XPathCondition(c.getExpression());
          break;
View Full Code Here

Examples of com.crawljax.core.state.Identification

  }

  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

Examples of com.crawljax.core.state.Identification

   * @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

Examples of com.crawljax.core.state.Identification

          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

Examples of com.crawljax.core.state.Identification

      // 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

Examples of com.crawljax.core.state.Identification

    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

Examples of com.crawljax.core.state.Identification

   *            the element
   * @param xpath
   *            the xpath expression of the element
   */
  public CandidateElement(Element element, String xpath, List<FormInput> formInputs) {
    this(element, new Identification(Identification.How.xpath, xpath), "", formInputs);
  }
View Full Code Here

Examples of com.crawljax.core.state.Identification

    when(index.getName()).thenReturn("Index");
    when(target.getId()).thenReturn(2);
    when(target.getName()).thenReturn("State 2");

    when(eventToTransferToTarget.getIdentification()).thenReturn(
            new Identification(How.name, "//DIV[@id='click]"));
    when(eventToTransferToTarget.getRelatedFrame()).thenReturn("");
    when(eventToTransferToTarget.getSourceStateVertex()).thenReturn(index);
    when(eventToTransferToTarget.getTargetStateVertex()).thenReturn(target);
    when(eventToTransferToTarget.getRelatedFormInputs()).thenReturn(
            new CopyOnWriteArrayList<FormInput>());
View Full Code Here

Examples of com.crawljax.core.state.Identification

   *             when the event can not be fired.
   */
  @Test
  public final void testFireEvent() throws Exception {
    browser.goToUrl(SERVER.getSiteUrl().resolve("simple.html"));
    browser.fireEventAndWait(new Eventable(new Identification(How.xpath, "//H1"),
            EventType.click));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.