use of org.codelibs.fess.crawler.client.http.action.FormAction in project fess-crawler by codelibs.
the class WebDriverClientTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
CrawlerPooledObjectFactory<CrawlerWebDriver> pooledObjectFactory = new CrawlerPooledObjectFactory<>();
pooledObjectFactory.setComponentName("webDriver");
pooledObjectFactory.setOnDestroyListener(p -> {
final CrawlerWebDriver driver = p.getObject();
driver.quit();
});
final StandardCrawlerContainer container = new StandardCrawlerContainer();
container.prototype("webDriver", CrawlerWebDriver.class).singleton("mimeTypeHelper", MimeTypeHelperImpl.class).singleton("pooledObjectFactory", pooledObjectFactory).singleton("webDriverPool", new GenericObjectPool<>(pooledObjectFactory), null, pool -> {
pool.close();
}).<AOnClickAction>singleton("aOnClickAction", AOnClickAction.class).<FormAction>singleton("formAction", FormAction.class).<WebDriverClient>singleton("webDriverClient", WebDriverClient.class, client -> {
AOnClickAction aOnClick = container.getComponent("aOnClickAction");
aOnClick.setName("aOnClick");
aOnClick.setCssQuery("a");
client.addUrlAction(aOnClick);
FormAction formAction = container.getComponent("formAction");
formAction.setName("form");
formAction.setCssQuery("form");
client.addUrlAction(formAction);
});
webDriverClient = container.getComponent("webDriverClient");
}
Aggregations