当前位置: 首页>>代码示例>>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;未经允许,请勿转载。