Menu

#1821 WebClient.getPage() could get an old page

2.23
closed
None
1
2016-09-21
2016-09-21
No

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().

1 Attachments

Discussion

  • Marc Guillemot

    Marc Guillemot - 2016-09-21

    Work as designed. Whether it is good or not is an other question ;-)
    A page doesn't change its location.

     
  • Marc Guillemot

    Marc Guillemot - 2016-09-21
    • status: open --> closed
    • assigned_to: Marc Guillemot
     
  • Rural Hunter

    Rural Hunter - 2016-09-21

    OK, understand. so this is my use pattern problem.

     

Log in to post a comment.