當前位置: 首頁>>代碼示例>>Java>>正文


Java CrawljaxConfigurationBuilder.setMaximumRunTime方法代碼示例

本文整理匯總了Java中com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder.setMaximumRunTime方法的典型用法代碼示例。如果您正苦於以下問題:Java CrawljaxConfigurationBuilder.setMaximumRunTime方法的具體用法?Java CrawljaxConfigurationBuilder.setMaximumRunTime怎麽用?Java CrawljaxConfigurationBuilder.setMaximumRunTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder的用法示例。


在下文中一共展示了CrawljaxConfigurationBuilder.setMaximumRunTime方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configureTimers

import com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder; //導入方法依賴的package包/類
private void configureTimers(CrawljaxConfigurationBuilder builder) {
	if (options.specifiesTimeOut()) {
		builder.setMaximumRunTime(options.getSpecifiedTimeOut(), TimeUnit.MINUTES);
	}
	if (options.specifiesWaitAfterEvent()) {
		builder.crawlRules().waitAfterEvent(options.getSpecifiedWaitAfterEvent(),
		        TimeUnit.MILLISECONDS);
	}
	if (options.specifiesWaitAfterReload()) {
		builder.crawlRules().waitAfterReloadUrl(options.getSpecifiedWaitAfterReload(),
		        TimeUnit.MILLISECONDS);
	}
}
 
開發者ID:aminmf,項目名稱:crawljax,代碼行數:14,代碼來源:JarRunner.java

示例2: main

import com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder; //導入方法依賴的package包/類
/**
 * Run this method to start the crawl.
 * 
 * @throws IOException
 *             when the output folder cannot be created or emptied.
 */
public static void main(String[] args) throws IOException {
	CrawljaxConfigurationBuilder builder = CrawljaxConfiguration.builderFor(URL);
	builder.crawlRules().insertRandomDataInInputForms(false);
	builder.setMaximumRunTime(100, TimeUnit.SECONDS);


	// click these elements
	builder.crawlRules().clickDefaultElements();
	builder.crawlRules().click("div").withAttribute("class", "clickable");

	// but don't click these
	builder.crawlRules().dontClick("a").withAttribute("class", "ignore");
	builder.crawlRules().dontClick("a").underXPath("//DIV[@id='footer']");

	// Set timeouts
	builder.crawlRules().waitAfterReloadUrl(WAIT_TIME_AFTER_RELOAD, TimeUnit.MILLISECONDS);
	builder.crawlRules().waitAfterEvent(WAIT_TIME_AFTER_EVENT, TimeUnit.MILLISECONDS);

	// Add a condition that this XPath doesn't exits
	builder.crawlRules().addCrawlCondition("No spans with foo as class",
	        new NotXPathCondition("//*[@class='foo']"));

	// Set some input for fields
	builder.crawlRules().setInputSpec(getInputSpecification());

	// This will generate a nice output in the output directory.
	File outFolder = new File("output");
	if (outFolder.exists()) {
		FileUtils.deleteDirectory(outFolder);
	}
	builder.setOutputDirectory(outFolder);
	builder.addPlugin(new CrawlOverview());

	// We want to use two browsers simultaneously.
	builder.setBrowserConfig(new BrowserConfiguration(BrowserType.FIREFOX, 1));

	CrawljaxRunner crawljax = new CrawljaxRunner(builder.build());
	crawljax.call();

}
 
開發者ID:aminmf,項目名稱:crawljax,代碼行數:47,代碼來源:AdvancedExample.java


注:本文中的com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder.setMaximumRunTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。