Package com.crawljax.core.state

Examples of com.crawljax.core.state.StateVertix


    List<Map<String, String>> elements = new ArrayList<Map<String, String>>();

    if (rendered != null) {
      for (RenderedCandidateElement element : rendered) {
        Eventable eventable = getEventableByCandidateElementInState(state, element);
        StateVertix toState = null;
        Map<String, String> elementMap = new HashMap<String, String>();
        if (eventable != null) {
          toState = sfg.getTargetState(eventable);
        }
        elementMap.put("left", "" + (element.getLocation().x - 1));
        elementMap.put("top", "" + (element.getLocation().y + 20 - 1));
        elementMap.put("width", "" + (element.getSize().width + 2));
        elementMap.put("height", "" + (element.getSize().height + 2));
        if (toState != null) {
          elementMap.put("targetname", toState.getName());
        } else {
          elementMap.put("targetname", "");
        }
        if (toState != null) {
          if (getStateNumber(toState) < getStateNumber(state)) {
View Full Code Here


   */
  private void goBackExact() throws CrawljaxException {
    /**
     * Thread safe
     */
    StateVertix curState = controller.getSession().getInitialState();

    for (Eventable clickable : backTrackPath) {

      if (!controller.getElementChecker().checkCrawlCondition(getBrowser())) {
        return;
View Full Code Here

    this.handleInputElements(eventable);

    LOGGER.info("Executing " + eventable.getEventType() + " on element: " + eventable
            + "; State: " + this.getStateMachine().getCurrentState().getName());
    if (this.fireEvent(eventable)) {
      StateVertix newState =
              new StateVertix(getBrowser().getCurrentUrl(), controller.getSession()
                      .getStateFlowGraph().getNewStateName(), getBrowser().getDom(),
                      this.controller.getStrippedDom(getBrowser()));
      if (isDomChanged(this.getStateMachine().getCurrentState(), newState)) {
        // Dom is changed, so data might need be filled in again
        controller.getSession().addEventableToCrawlPath(eventable);
View Full Code Here

  private ClickResult crawlAction(CandidateCrawlAction action) throws CrawljaxException {
    CandidateElement candidateElement = action.getCandidateElement();
    EventType eventType = action.getEventType();

    StateVertix orrigionalState = this.getStateMachine().getCurrentState();

    if (candidateElement.allConditionsSatisfied(getBrowser())) {
      ClickResult clickResult = clickTag(new Eventable(candidateElement, eventType));
      switch (clickResult) {
        case cloneDetected:
View Full Code Here

    if (!checkConstraints()) {
      return false;
    }

    // Store the currentState to be able to 'back-track' later.
    StateVertix orrigionalState = this.getStateMachine().getCurrentState();

    if (orrigionalState.searchForCandidateElements(candidateExtractor, configurationReader
            .getTagElements(), configurationReader.getExcludeTagElements(),
            configurationReader.getCrawlSpecificationReader().getClickOnce())) {
      // Only execute the preStateCrawlingPlugins when it's the first time
      LOGGER.info("Starting preStateCrawlingPlugins...");
      CrawljaxPluginsUtil.runPreStateCrawlingPlugins(controller.getSession(),
              orrigionalState.getUnprocessedCandidateElements());
    }

    CandidateCrawlAction action =
            orrigionalState.pollCandidateCrawlAction(this, crawlQueueManager);
    while (action != null) {
      if (depthLimitReached(depth)) {
        return true;
      }

      if (!checkConstraints()) {
        return false;
      }
      ClickResult result = this.crawlAction(action);
      orrigionalState.finishedWorking(this, action);
      switch (result) {
        case newState:
          return newStateDetected(orrigionalState);
        case cloneDetected:
          return true;
        default:
          break;
      }
      action = orrigionalState.pollCandidateCrawlAction(this, crawlQueueManager);
    }
    return true;
  }
View Full Code Here

    goToInitialURL();

    /**
     * Build the index state
     */
    StateVertix indexState =
            new StateVertix(this.getBrowser().getCurrentUrl(), "index", this.getBrowser()
                    .getDom(), controller.getStrippedDom(this.getBrowser()));

    /**
     * Build the StateFlowGraph
     */
 
View Full Code Here

          final StateMachine stateMachine) {
    LOGGER.info("Running GuidedCrawlingPlugins...");
    for (Plugin plugin : CrawljaxPluginsUtil.PLUGINS) {
      if (plugin instanceof GuidedCrawlingPlugin) {
        LOGGER.info("Calling plugin " + plugin.getClass().getName());
        StateVertix currentState = session.getCurrentState();
        ((GuidedCrawlingPlugin) plugin).guidedCrawling(currentState, controller, session,
                exactEventPaths, stateMachine);
      }
    }
  }
View Full Code Here

  /**
   * @return the currentState
   */
  public StateVertix getCurrentState() {
    StateVertix sv = tlState.get();
    if (sv == null) {
      tlState.set(getInitialState());
    } else {
      return sv;
    }
View Full Code Here

    goToInitialURL();

    /**
     * Build the index state
     */
    StateVertix indexState =
            new StateVertix(this.getBrowser().getCurrentUrl(), "index",
                    this.getBrowser().getDom(), controller.getStrippedDom(this.getBrowser()));

    /**
     * Build the StateFlowGraph
     */
 
View Full Code Here

  /**
   * @return the currentState
   */
  public StateVertix getCurrentState() {
    StateVertix sv = tlState.get();
    if (sv == null) {
      tlState.set(getInitialState());
    } else {
      return sv;
    }
View Full Code Here

TOP

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

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.