I did not find a clear and obvious suggestion to emulate the browser back button in HtmlUnit. Did you do it? If so, how?
The best I came up with is to execute javascript on the current page:
ScriptResult result = currentPage.executeJavaScript("javascript:window.history.back();");
currentPage = (HtmlPage)result.getNewPage();
Is there a way to return to a single page in a story using htmlunit? What are the consequences of returning to the above code? Although I have not convinced myself that HtmlUnit really does any exact emulation of the javascript interpretation of different browsers, how close have I come to using the full HtmlUnit feature to emulate the browser back button using the above code? Is there a way to get better emulation of the browser back button than this?
Also, I noticed the History class in HtmlUnit, but it seems completely useless. Thoughts?
source
share