Menu

#127 refreshing a page to which form parameters have been posted

closed
None
5
2012-10-21
2008-04-18
No

Please add a feature to HtmlUnit that allows for easily refreshing the current page (as a web browser would do when pressing F5 or by pressing the browser refresh button).

Below is the email thread that led to the creation of this issue.

----- Forwarded Message ----
From: Marc Guillemot mguillemot@yahoo.fr
To: htmlunit-user@lists.sourceforge.net
Sent: Friday, April 18, 2008 12:49:27 AM
Subject: Re: [Htmlunit-user] How do you refresh the current page with HtmlUnit

your request makes sense: a WebResponse needs to provide access to the
WebRequestSettings used to retrieve it. This is something I want to add
since a long time. Please open an issue for it.

Cheers,
Marc.

----- Forwarded Message ----
From: Saladin Sharif al_zawiah@yahoo.com
To: htmlunit-user@lists.sourceforge.net
Sent: Thursday, April 17, 2008 5:53:46 PM
Subject: Re: [Htmlunit-user] How do you refresh the current page with HtmlUnit

URL by "page.getWebResponse().getUrl()", and you can
make another request, exactly as browsers do.

Yes, but you see the parameters that were posted to the current page, were not posted through the URL; but rather they were posted through a form (in which the method="post" ). So even if you copy and paste the exact same URL into the browser window and hit enter it would not have the same effect as doing an F5 refresh (because the form parameters will not get reposted to the page). So then how would I accomplish such a refresh with HtmlUnit?

Thanks,

-Saladin

----- Forwarded Message ----
From: Ahmed Ashour asashour@yahoo.com
To: htmlunit-user@lists.sourceforge.net
Sent: Thursday, April 17, 2008 4:35:50 PM
Subject: Re: [Htmlunit-user] How do you refresh the current page with HtmlUnit

Dear Saladin,

You can use webClient.getPage() of the same URL again.

Hope that helps,
Ahmed

----- Original Message ----
From: Saladin Sharif al_zawiah@yahoo.com
To: htmlunit-user@lists.sourceforge.net
Sent: Friday, April 18, 2008 2:32:46 AM
Subject: [Htmlunit-user] How do you refresh the current page with HtmlUnit

Hi,
Is there a quick and easy way to refresh the current page using HtmlUnit?
I noticed the RefreshHandler class in the HtmlUnit Javadocs. Do I need to use that class, or is there another more straight forward way of performing a refresh for a page, for example something like currentPage.refresh() ?
Thanks in advance,
-Saladin

Discussion

  • Ahmed Ashour

    Ahmed Ashour - 2008-04-20

    Logged In: YES
    user_id=950730
    Originator: NO

    Change to 'feature request'

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-04-27

    Logged In: YES
    user_id=950730
    Originator: NO

    Implemented in SVN, you can get latest snapshot from http://build.canoo.com/htmlunit.

    Please use HtmlPage.refresh().

    Enjoy!

     
  • Saladin Sharif

    Saladin Sharif - 2008-04-28

    Logged In: YES
    user_id=2066777
    Originator: YES

    Awesome!! Thanks a whole bunch :)

     

Log in to post a comment.