Here's my scenario. I'm testing a Wicket app, and I'm parsing the page text wicktetTester.getServletResponse.getDocument
as XML in order to find components with XPath. This is quite expensive, so I'd like to keep the dom4j.Document
until the page changes, then rebuild it.
I know the current page - wicketTester.getLastRenderedPage
but if I for example submit a form and stay on the same page, the Page
object is the same object. What property of the page can I query to know that it has been re-rendered and that I need to rebuild my DOM?
public Document getDocument() {
if (tester.getLastRenderedPage() != lastPageParsed && SOME_OTHER_TEST) {
cachedDocument = parse(tester.getServletResponse().getDocument();
lastPageParsed = tester.getLastRenderedPage();
}
return cachedDocument;
}