Examples of CrawlSession


Examples of com.crawljax.core.CrawlSession

public class SampleCrawlersTest {

  @Test
  public void testSimpleCrawler() throws Exception {
    CrawlSession crawl = new SimpleSiteCrawl().crawl();
    StateFlowGraph stateFlowGraph = crawl.getStateFlowGraph();
    assertThat(stateFlowGraph, hasStates(SimpleSiteCrawl.NUMBER_OF_STATES));
    assertThat(stateFlowGraph, hasEdges(SimpleSiteCrawl.NUMBER_OF_EDGES));
  }
View Full Code Here

Examples of com.crawljax.core.CrawlSession

    assertThat(stateFlowGraph, hasEdges(SimpleSiteCrawl.NUMBER_OF_EDGES));
  }

  @Test
  public void testJSCrawler() throws Exception {
    CrawlSession crawl = new SimpleJsSiteCrawl().crawl();
    StateFlowGraph stateFlowGraph = crawl.getStateFlowGraph();
    assertThat(stateFlowGraph, hasStates(SimpleJsSiteCrawl.NUMBER_OF_STATES));
    assertThat(stateFlowGraph, hasEdges(SimpleJsSiteCrawl.NUMBER_OF_EDGES));
  }
View Full Code Here

Examples of com.crawljax.core.CrawlSession

  }

  @Test
  public void testInputCrawler() throws Exception {
    // new SimpleInputSiteCrawl().showWebSite();
    CrawlSession crawl = new SimpleInputSiteCrawl().crawl();
    StateFlowGraph stateFlowGraph = crawl.getStateFlowGraph();
    assertThat(stateFlowGraph, hasStates(SimpleInputSiteCrawl.NUMBER_OF_STATES));
    assertThat(stateFlowGraph, hasEdges(SimpleInputSiteCrawl.NUMBER_OF_EDGES));
  }
View Full Code Here

Examples of com.crawljax.core.CrawlSession

  /**
   * Shows <a href='https://github.com/crawljax/crawljax/issues/97'>Issue 97</a>
   */
  @Test
  public void whenHiddenElementsOfItShouldntCrawl() throws Exception {
    CrawlSession crawl = new BaseCrawler("hidden-elements-site").crawl();
    StateFlowGraph stateFlowGraph = crawl.getStateFlowGraph();

    // this includes the bug of #97
    int expectedStates = 3 - 2;
    assertThat(stateFlowGraph, hasStates(expectedStates));
  }
View Full Code Here

Examples of com.crawljax.core.CrawlSession

  /**
   * Shows <a href='https://github.com/crawljax/crawljax/issues/97'>Issue 97</a>
   */
  @Test
  public void testHiddenElementsSiteCrawl() throws Exception {
    CrawlSession crawl = new BaseCrawler("hidden-elements-site") {
      @Override
      public CrawljaxConfigurationBuilder newCrawlConfigurationBuilder() {
        CrawljaxConfigurationBuilder builder =
                super.newCrawlConfigurationBuilder();
        builder.crawlRules().crawlHiddenAnchors(true);
        return builder;
      }
    }.crawl();

    StateFlowGraph stateFlowGraph = crawl.getStateFlowGraph();
    /*
     * TODO Fix issue #97 https://github.com/crawljax/crawljax/issues/97 It is now party hacked
     * by following HREF links.
     */
    int withIssue97 = 3 - 1;
View Full Code Here

Examples of com.crawljax.core.CrawlSession

  public void setup(StateVertex indexState) {
    if (!isSet.getAndSet(true)) {
      LOG.debug("Setting up the crawlsession");
      StateVertex added = stateFlowGraph.putIfAbsent(indexState, false);
      Preconditions.checkArgument(added == null, "Could not set the initial state");
      session = new CrawlSession(config, stateFlowGraph, indexState);
    } else {
      throw new IllegalStateException("Session is already set");
    }
  }
View Full Code Here

Examples of com.crawljax.core.CrawlSession

    CrawlRulesBuilder rules = builder.crawlRules();
    rules.dontClick("a").withAttribute("id", "noClickId");
    rules.dontClickChildrenOf("div").withClass("noChildrenOfClass");
    rules.dontClickChildrenOf("div").withId("noChildrenOfId");

    CrawlSession session = new CrawljaxRunner(builder.build()).call();

    assertThat(session.getStateFlowGraph(), hasStates(2));
  }
View Full Code Here

Examples of com.crawljax.core.CrawlSession

      }
    });
    int depth = 3;

    CrawljaxRunner runner = new CrawljaxRunner(builder.setMaximumDepth(depth).build());
    CrawlSession session = runner.call();

    assertThat(session.getStateFlowGraph(), hasStates(1));
    assertThat(runner.getReason(), is(ExitNotifier.ExitStatus.EXHAUSTED));
  }
View Full Code Here

Examples of com.crawljax.core.CrawlSession

  public void setup(StateVertex indexState) {
    if (!isSet.getAndSet(true)) {
      LOG.debug("Setting up the crawlsession");
      StateVertex added = stateFlowGraph.putIndex(indexState);
      Preconditions.checkArgument(added == null, "Could not set the initial state");
      session = new CrawlSession(config, stateFlowGraph, indexState, registry);
    } else {
      throw new IllegalStateException("Session is already set");
    }
  }
View Full Code Here

Examples of com.crawljax.core.CrawlSession

  /**
   * Shows <a href='https://github.com/crawljax/crawljax/issues/97'>Issue 97</a>
   */
  @Test
  public void testHiddenElementsSiteCrawl() throws Exception {
    CrawlSession crawl = new BaseCrawler("hidden-elements-site") {
      @Override
      public CrawljaxConfigurationBuilder newCrawlConfigurationBuilder() {
        CrawljaxConfigurationBuilder builder =
                super.newCrawlConfigurationBuilder();
        builder.crawlRules().crawlHiddenAnchors(true);
        return builder;
      }
    }.crawl();

    StateFlowGraph stateFlowGraph = crawl.getStateFlowGraph();
    /*
     * TODO Fix issue #97 https://github.com/crawljax/crawljax/issues/97 It is now party hacked
     * by following HREF links.
     */
    int withIssue97 = 3 - 1;
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.