From: Brehm, R. P <rob...@of...> - 2004-10-04 23:06:52
|
Brad, Thanks, this provided me the exact functionality that I was looking for. I created a utility class that encapsulated the below methods: public final class HtmlUnitTestUtils { public static final Page getCurrentPage(WebClient wc) { return wc.getCurrentWindow().getEnclosedPage(); } public static final URL getCurrentURL(WebClient wc) { Page p = getCurrentPage(wc); return p.getWebResponse().getUrl(); } } Perhaps these can be incorporated into WebClient. Bob -----Original Message----- From: htm...@li... [mailto:htm...@li...]On Behalf Of Brad Clarke Sent: Monday, October 04, 2004 12:01 PM To: htm...@li... Subject: Re: [Htmlunit-user] Difficulties running JavaScript (Your God) It's a bit of a road to find it, but it's in there :) This is how my framework handles it: private WebClient getClient() { return this.client; } private Page getCurrentPage() { return getClient().getCurrentWindow().getEnclosedPage(); } public String getCurrentURL() { return getCurrentPage().getWebResponse().getUrl().toExternalForm(); } Brad C --- "Brehm, Robert P" <rob...@of...> wrote: > Brad C, > > Looking at the URL from the WebClient would probably work. I have looked thru the > JavaDocs and have not found a method yet that will give me the URL. Would Can you > please advise? Also, I am wondering if a listener for WebConnection events is in > the works for a future generation of HtmlUnit? > > Regards, > > Bob Brehm > > > ------------------------------------------------------- > This SF.net email is sponsored by: IT Product Guide on ITManagersJournal > Use IT products in your business? Tell us what you think of them. Give us > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more > http://productguide.itmanagersjournal.com/guidepromo.tmpl > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |