From: Mike B. <mb...@Ga...> - 2003-02-19 18:17:37
|
Mik...@su... wrote: > I have a need to simulate the browser refresh button. I.e. I want to > reload a page. I don't see a direct way to do this in HtmlUnit 1.1. > Is there something that I am not seeing? No, you aren't overlooking anything. There is no direct support for simulating the refresh button. > Assuming there is not, one simple way to partially solve > the problem is to add the following function to HtmlPage: Take a look at page.getWebResponse().getUrl() and see if that does what you need (for GET requests anyway). > However, this will only work for pages that are a result of a HTTP Get > requests. It will work for pages that were a result of a Post request, > because the URL will not contain the request parameters. Right, the WebResponse doesn't currently retain the request parameters which is what you'd need for a proper refresh. At a minimum the WebResponse would have to change to retain the parameters that were originally used and the request type (GET/POST/etc). Then Page could additionally have a reload() method (I want to avoid the word "refresh" as that implies updating the current object and I'd want to return a new one). Would this do everything you need? -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |