Walk via making a WebWalkEvent object, and use the method setBreakCondition(Condition breakCondition), then execute the event.
You need to make a Condition object that has the condition where you want the event to terminate.
Example:
Condition condition = new Condition() {
@Override
public boolean evaluate() {
return getBank().isOpen();
}
};