Package com.crawljax.core.configuration

Examples of com.crawljax.core.configuration.CrawlSpecification


   * @throws Exception
   *             When the webserver fails to start.
   */
  public void setup() throws Exception {
    webServer.start();
    crawlSpec = new CrawlSpecification(getUrl());
    crawlSpec.clickDefaultElements();
    config = new CrawljaxConfiguration();
    config.setCrawlSpecification(crawlSpec);
    hasSetup.set(true);
  }
View Full Code Here


  /**
   * @param args
   */
  public static void main(String[] args) {
    CrawljaxConfiguration config = new CrawljaxConfiguration();
    CrawlSpecification crawler = new CrawlSpecification(URL);
    crawler.setMaximumStates(5);
    crawler.clickDefaultElements();
    config.setCrawlSpecification(crawler);
    config.addPlugin(new CrawlOverview());
    try {
      CrawljaxController crawljax = new CrawljaxController(config);
      crawljax.run();
View Full Code Here

  /**
   * @return the CrawlSpecification from the saved CrawlSession
   */
  public CrawlSpecification getCrawlSpecification() {
    CrawlSpecification spec = new CrawlSpecification(savedCrawlSession.getUrl());
    spec.setMaximumStates(savedCrawlSession.getMapStates().size());
    spec.clickDefaultElements();
    return spec;
  }
View Full Code Here

  public static void main(String[] args) {
    if (args.length < 1) {
      System.err.println("Please give an url as first argument to Crawljax");
      System.exit(1);
    }
    CrawlSpecification crawler = new CrawlSpecification(args[0]);
    crawler.clickDefaultElements();

    CrawljaxConfiguration config = new CrawljaxConfiguration();

    config.setCrawlSpecification(crawler);
View Full Code Here

   * @param args
   *            args are ignored
   */
  public static void main(String[] args) {

    CrawlSpecification spec = new CrawlSpecification(Utils.URL);
    spec.setMaximumStates(5);
    spec.clickDefaultElements();

    CrawljaxConfiguration config = new CrawljaxConfiguration();
    config.setBrowser(BrowserType.firefox);
    config.setCrawlSpecification(spec);

View Full Code Here

   */
  private static CrawljaxConfiguration getConfig() {
    CrawljaxConfiguration config = new CrawljaxConfiguration();
    config.setBrowser(BrowserType.firefox);

    CrawlSpecification crawler = new CrawlSpecification("http://www.google.com");
    crawler.setWaitTimeAfterEvent(500);
    crawler.setWaitTimeAfterReloadUrl(500);

    // click on all anchor tags
    crawler.click("a");
    // and all input tags with "submit"
    crawler.click("input").withAttribute("type", "submit");

    // exclude these
    crawler.dontClick("a").underXPath("//DIV[@id='guser']");
    crawler.dontClick("a").withText("Language Tools");

    InputSpecification inputSpec = new InputSpecification();
    inputSpec.field("q").setValue("Crawljax");
    crawler.setInputSpecification(inputSpec);

    // Constrain the crawl to Google (no other web sites)
    crawler.addCrawlCondition("Only crawl Google", new UrlCondition("google"));

    // limit the crawling scope
    crawler.setMaximumStates(6);
    crawler.setDepth(2);

    config.setCrawlSpecification(crawler);

    return config;
  }
View Full Code Here

   * @param args
   *            args are ignored
   */
  public static void main(String[] args) {

    CrawlSpecification spec = new CrawlSpecification(Utils.URL);
    spec.setMaximumStates(5);
    spec.clickDefaultElements();

    CrawljaxConfiguration config = new CrawljaxConfiguration();
    config.setBrowser(BrowserType.firefox);
    config.setCrawlSpecification(spec);

View Full Code Here

 
  /**
   * @return the CrawlSpecification from the saved CrawlSession
   */
  public CrawlSpecification getCrawlSpecification() {
    CrawlSpecification spec = new CrawlSpecification(savedCrawlSession.getUrl());
    spec.setMaximumStates(savedCrawlSession.getMapStates().size());
    spec.clickDefaultElements();
    return spec;
  }
View Full Code Here

  private SiteSimpleExample() {
    // Utility class
  }

  private static CrawlSpecification getCrawlSpecification() {
    CrawlSpecification crawler = new CrawlSpecification(URL);

    crawler.clickDefaultElements();
    crawler.dontClick(ALL_ANCHORS).underXPath(HEADER_XPATH);
    crawler.dontClick(ALL_ANCHORS).withText(LANGUAGE_TOOLS);

    // limit the crawling scope
    crawler.setMaximumStates(MAX_STATES);
    crawler.setDepth(MAX_CRAWL_DEPTH);

    crawler.setInputSpecification(getInputSpecification());

    // Make sure we only crawl Google and no external web site
    crawler.addCrawlCondition("Only crawl Google", new UrlCondition("google"));

    return crawler;
  }
View Full Code Here

    tc.setNumberThreads(1);
    return tc;
  }

  private static CrawlSpecification getCrawlSpecification() {
    CrawlSpecification crawler = new CrawlSpecification(URL);
    crawler.setRandomInputInForms(false);
    // click these elements

    crawler.click("a");
    crawler.click("button");

    // except these
    crawler.dontClick("a").underXPath("//DIV[@id='guser']");
    crawler.dontClick("a").withText("Language Tools");

    crawler.setInputSpecification(getInputSpecification());

    // limit the crawling scope
    crawler.setMaximumStates(MAX_NUMBER_STATES);
    crawler.setDepth(MAX_DEPTH);

    return crawler;
  }
View Full Code Here

TOP

Related Classes of com.crawljax.core.configuration.CrawlSpecification

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.