Package com.crawljax.core

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


  @Test
  public void webBrowserWindowOpensItIsIgnored() {
    BaseCrawler crawler =
            new BaseCrawler(Resource.newClassPathResource("/site"), "download/download.html");
    CrawlSession crawl = crawler.crawl();
    assertThat(crawl.getStateFlowGraph(), hasStates(2));
  }
View Full Code Here

public class ChromeProxyConfig {

  @Test
  public void chromeProxyConfig() {
    assumeThat(System.getProperty("webdriver.chrome.driver"), is(notNullValue()));
    CrawlSession crawl =
            new BaseCrawler(Resource.newClassPathResource("/site"),
                    "simplelink/simplelink.html") {
              @Override
              public CrawljaxConfigurationBuilder newCrawlConfigurationBuilder() {
                CrawljaxConfigurationBuilder builder =
                        super.newCrawlConfigurationBuilder();
                builder.setBrowserConfig(new BrowserConfiguration(BrowserType.CHROME));
                return builder;
              }
            }.crawl();
    assertThat(crawl.getStateFlowGraph(), hasStates(2));
  }
View Full Code Here

  public CrawlSession crawl() throws CrawljaxException {
    if (!hasSetup.get()) {
      setup();
    }
    CrawljaxRunner crawljax = new CrawljaxRunner(configBuilder.build());
    CrawlSession session = crawljax.call();
    webServer.stop();
    return session;
  }
View Full Code Here

  @Test
  public void whenJavaScriptNavigatesAwayFromPageItIsBlocked() throws Exception {
    BaseCrawler crawler = new BaseCrawler("navigate_other_urls.html");
    // crawler.showWebSite();
    CrawlSession session = crawler.crawl();
    assertThat(session.getStateFlowGraph(), hasStates(5));
  }
View Full Code Here

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

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

  @Test
  public void webBrowserWindowOpensItIsIgnored() {
    BaseCrawler crawler =
            new BaseCrawler(Resource.newClassPathResource("/site"), "download/download.html");
    CrawlSession crawl = crawler.crawl();
    assertThat(crawl.getStateFlowGraph(), hasStates(2));
  }
View Full Code Here

  public CrawlSession crawl() throws CrawljaxException {
    if (!hasSetup.get()) {
      setup();
    }
    CrawljaxRunner crawljax = new CrawljaxRunner(configBuilder.build());
    CrawlSession session = crawljax.call();
    webServer.stop();
    return session;
  }
View Full Code Here

  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);
    } else {
      throw new IllegalStateException("Session is already set");
    }
  }
View Full Code Here

TOP

Related Classes of com.crawljax.core.CrawlSession

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.