I'm not sure this is a bug or use pattern problem.
This test code is like this:
HtmlPage p=client.getPage(getClass().getResource("pagejump.html"));
client.waitForBackgroundJavaScript(2000);
logger.info(p.getTitleText());
HtmlPage newPage=(HtmlPage)p.getEnclosingWindow().getEnclosedPage();
logger.info(newPage.getTitleText());
pagejump.html is attached. Basically the page sets a different location using js in a setTimeout function. In this case, The page returned by WebClient.getPage() is still the old page. The final page can only be retrieved by oldPage.getEnclosingWindow().getEnclosedPage().
Work as designed. Whether it is good or not is an other question ;-)
A page doesn't change its location.
OK, understand. so this is my use pattern problem.