本文整理匯總了Java中com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder.setMaximumStates方法的典型用法代碼示例。如果您正苦於以下問題:Java CrawljaxConfigurationBuilder.setMaximumStates方法的具體用法?Java CrawljaxConfigurationBuilder.setMaximumStates怎麽用?Java CrawljaxConfigurationBuilder.setMaximumStates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder
的用法示例。
在下文中一共展示了CrawljaxConfigurationBuilder.setMaximumStates方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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();
}
示例2: testDontClickUnderXPath
import com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder; //導入方法依賴的package包/類
@Test
public void testDontClickUnderXPath() throws Exception {
String url = "http://localhost:" + port + "/infinite.html";
CrawljaxConfigurationBuilder builder =
CrawljaxConfiguration.builderFor(url);
builder.setMaximumStates(3);
builder.setBasicAuth(USERNAME, PASSWORD);
CrawlSession session = new CrawljaxRunner(builder.build()).call();
assertThat(session.getStateFlowGraph(), hasStates(3));
}
示例3: 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);
}
示例4: 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();
}