return graph.getShortestPath(graph.getInitialState(), crawlTask);
}
private void follow(CrawlPath path, StateVertex targetState)
throws StateUnreachableException, CrawljaxException {
StateVertex curState = context.getSession().getInitialState();
for (Eventable clickable : path) {
checkCrawlConditions(targetState);
LOG.debug("Backtracking by executing {} on element: {}", clickable.getEventType(),
clickable);
curState = changeState(targetState, clickable);
handleInputElements(clickable);
tryToFireEvent(targetState, curState, clickable);
checkCrawlConditions(targetState);
}
if (!curState.equals(targetState)) {
throw new StateUnreachableException(targetState,
"The path didn't result in the desired state but in state "
+ curState.getName());
}
}