In HtmlUnit there is no way to disable the story that I know of. The History class has a getHistory () method, but not setHistory () or disableHistory (). What I did, and this is certainly not perfect, is to free up the web page and restore it. Until you issue a CookieManager, you should be fine at the front of the cookie. Basically, as soon as I completely go through and log into the system, I reset my window after saving the current page in the temp line, and then again create it where I left off. I do this at certain points to clear the story.
String tempPage = currentHtmlPage.getUrl().toString();
This allows the window to pick up the place where it was stopped. Its ugly, but if you are desperate, this might work.
source share