Search code examples
javahtmlhtmlunit

Java HTMLUnit - How do I access the page DOM I'm sent to after submitting a form


I'm very confused on how to access the newly loaded page's DOM after I .click() the submit button on a page and am sent to another one.

Any ideas?

Thanks.


Solution

  • The click() method should return an HtmlPage object with the new page:

    HtmlPage newPage = myElement.click();