How to force HtmlUnit to save page?

Posted by booroondook on Stack Overflow See other posts from Stack Overflow or by booroondook
Published on 2010-05-07T10:42:23Z Indexed on 2010/05/07 10:48 UTC
Read the original article Hit count: 287

Filed under:
|

Hello. I'm using HtmlUnit to click on a HtmlElement that triggers Javascript action:

currentPage = ((HtmlElement) currentPage.getByXPath("//*[contains(@onclick, 'check();')]").get(0)).click();

The element is:

<a href="#" onclick="check(); return false;">

The page returned is quite similar to the page, containing that element: same URL, mostly same HTML, but there are some minor differences in the HTML and HtmlUnit doesn't save the new page. I'm using HttpAnalyzer to sniff the traffic and I see that the Webclient correctly handles JS and send the right request. The response is also correct, but when I dump the contents of the currentPage to a file, I see that the actual page didn't change. How can I fix it?

© Stack Overflow or respective owner

Related posts about htmlunit

Related posts about java