当前位置: 首页>>代码示例>>Java>>正文


Java CrawljaxConfigurationBuilder.setMaximumDepth方法代码示例

本文整理汇总了Java中com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder.setMaximumDepth方法的典型用法代码示例。如果您正苦于以下问题:Java CrawljaxConfigurationBuilder.setMaximumDepth方法的具体用法?Java CrawljaxConfigurationBuilder.setMaximumDepth怎么用?Java CrawljaxConfigurationBuilder.setMaximumDepth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder的用法示例。


在下文中一共展示了CrawljaxConfigurationBuilder.setMaximumDepth方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder; //导入方法依赖的package包/类
/**
 * Entry point
 */
public static void main(String[] args) {
	CrawljaxConfigurationBuilder builder = CrawljaxConfiguration.builderFor(URL);
	builder.crawlRules().insertRandomDataInInputForms(false);

	builder.crawlRules().click("a");
	builder.crawlRules().click("button");

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

	// limit the crawling scope
	builder.setMaximumStates(MAX_NUMBER_STATES);
	builder.setMaximumDepth(MAX_DEPTH);

	builder.addPlugin(new SamplePlugin());

	builder.crawlRules().setInputSpec(getInputSpecification());

	CrawljaxRunner crawljax = new CrawljaxRunner(builder.build());
	crawljax.call();
}
 
开发者ID:aminmf,项目名称:crawljax,代码行数:26,代码来源:Runner.java

示例2: getCrawljaxConfiguration

import com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder; //导入方法依赖的package包/类
/**
 * retrieve / build the CrawljaxConfiguration for the given arguments.
 */
protected CrawljaxConfiguration getCrawljaxConfiguration() {

	CrawljaxConfigurationBuilder builder =
	        CrawljaxConfiguration.builderFor(WEB_SERVER.getSiteUrl());
	builder.crawlRules().waitAfterEvent(getTimeOutAfterEvent(), TimeUnit.MILLISECONDS);
	builder.crawlRules()
	        .waitAfterReloadUrl(getTimeOutAfterReloadUrl(), TimeUnit.MILLISECONDS);
	builder.setMaximumDepth(3);
	builder.crawlRules().clickOnce(true);

	builder.setBrowserConfig(getBrowserConfiguration());

	addCrawlElements(builder);

	builder.crawlRules().setInputSpec(getInputSpecification());

	addCrawlConditions(builder);
	addOracleComparators(builder);
	addInvariants(builder);
	addWaitConditions(builder);
	addPlugins(builder);

	return builder.build();
}
 
开发者ID:aminmf,项目名称:crawljax,代码行数:28,代码来源:LargeTestBase.java

示例3: testPopups

import com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder; //导入方法依赖的package包/类
@Test
public void testPopups() throws CrawljaxException {
	CrawljaxConfigurationBuilder builder =
	        CrawljaxConfiguration.builderFor(WEB_SERVER.getSiteUrl().toExternalForm()
	                + "popup");
	builder.setMaximumDepth(3);
	builder.crawlRules().click("a");
	builder.crawlRules().waitAfterEvent(100, TimeUnit.MILLISECONDS);
	builder.crawlRules().waitAfterReloadUrl(100, TimeUnit.MILLISECONDS);
	CrawljaxRunner runner = new CrawljaxRunner(builder.build());
	CrawlSession session = runner.call();
	assertThat(session.getStateFlowGraph(), hasEdges(2));
	assertThat(session.getStateFlowGraph(), hasStates(3));
}
 
开发者ID:aminmf,项目名称:crawljax,代码行数:15,代码来源:PopUpTest.java

示例4: setupConfig

import com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder; //导入方法依赖的package包/类
protected CrawljaxConfigurationBuilder setupConfig() {
	CrawljaxConfigurationBuilder builder =
	        CrawljaxConfiguration.builderFor(WEB_SERVER.getSiteUrl().toExternalForm()
	                + "iframe");
	builder.crawlRules().waitAfterEvent(100, TimeUnit.MILLISECONDS);
	builder.crawlRules().waitAfterReloadUrl(100, TimeUnit.MILLISECONDS);
	builder.setMaximumDepth(3);
	builder.crawlRules().click("a");
	builder.crawlRules().click("input");

	return builder;
}
 
开发者ID:aminmf,项目名称:crawljax,代码行数:13,代码来源:IFrameTest.java

示例5: configureCrawljax

import com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder; //导入方法依赖的package包/类
/**
 * Set Crawljax configuration here
 * @param builder
 */
private void configureCrawljax(CrawljaxConfigurationBuilder builder) {
	
	CSSCatcher cssCatcher = new CSSCatcher();
	cssCatcher.setOutputFolder(outputFolder + "css/");
	
	builder.addPlugin(new CrawlOverview());
	builder.addPlugin(cssCatcher);
	
	//builder.addPlugin(new LoginPlugin());
	
	//builder.crawlRules().clickDefaultElements();
	//builder.crawlRules().dontClick("input").withAttribute("value", "I don't recognize");
	//builder.crawlRules().click("input").withAttribute("type", "submit");
	//builder.crawlRules().dontClick("a").underXPath("//*[@id='pageFooter']");
	//builder.crawlRules().dontClick("a").underXPath("//*[@id='content']/div/div[2]");
	//System.getProperties().setProperty("webdriver.chrome.driver", "chromedriver.exe");
	//builder.setBrowserConfig(new BrowserConfiguration(BrowserType.CHROME, 2));
	builder.setBrowserConfig(new BrowserConfiguration(BrowserType.FIREFOX, 1));
	builder.crawlRules().insertRandomDataInInputForms(false);
	builder.crawlRules().clickElementsInRandomOrder(false);
	builder.crawlRules().crawlFrames(true);
	builder.crawlRules().dontClick("*");
	
	//com.crawljax.browser.WebDriverBackedEmbeddedBrowser s;
	
	builder.setOutputDirectory(new File(outputFolder + "/crawljax"));
					
	builder.setMaximumDepth(1);
	builder.setMaximumStates(2);
	
	builder.crawlRules().waitAfterReloadUrl(20, TimeUnit.MILLISECONDS);
	builder.crawlRules().waitAfterEvent(200, TimeUnit.MILLISECONDS);
	
}
 
开发者ID:dmazinanian,项目名称:css-analyser,代码行数:39,代码来源:Crawler.java

示例6: readConfig

import com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder; //导入方法依赖的package包/类
private CrawljaxConfiguration readConfig(String urlValue, String outputDir) {
	CrawljaxConfigurationBuilder builder = CrawljaxConfiguration.builderFor(urlValue);

	builder.setOutputDirectory(new File(outputDir));

	BrowserType browser = BrowserType.FIREFOX;
	if (options.specifiesBrowser()) {
		browser = options.getSpecifiedBrowser();
	}

	int browsers = 1;
	if (options.specifiesParallelBrowsers()) {
		browsers = options.getSpecifiedNumberOfBrowsers();
	}
	if (browser == BrowserType.REMOTE) {
		String remoteUrl = options.getSpecifiedRemoteBrowser();
		builder.setBrowserConfig(BrowserConfiguration.remoteConfig(browsers, remoteUrl));
	} else {
		builder.setBrowserConfig(new BrowserConfiguration(browser, browsers));
	}

	if (options.specifiesDepth()) {
		builder.setMaximumDepth(options.getSpecifiedDepth());
	}

	if (options.specifiesMaxStates()) {
		builder.setMaximumStates(options.getMaxStates());
	}

	if (options.requestsCrawlHiddenAnchors()) {
		builder.crawlRules().crawlHiddenAnchors(true);
	}

	configureTimers(builder);

	builder.addPlugin(new CrawlOverview());

	if (options.specifiesClickElements()) {
		builder.crawlRules().click(options.getSpecifiedClickElements());
	} else {
		builder.crawlRules().clickDefaultElements();
	}

	return builder.build();
}
 
开发者ID:aminmf,项目名称:crawljax,代码行数:46,代码来源:JarRunner.java


注:本文中的com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder.setMaximumDepth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。