Feature Requests item #2697234, was opened at 2009-03-21 00:49 Message generated for change (Comment added) made by jevonwright You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=497985&aid=2697234&group_id=61302
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core API Group: Release 2.2 Status: Closed Priority: 8 Private: No Submitted By: James Tse (jtse) Assigned to: Jevon Wright (jevonwright) Summary: Make HtmlUnit objects accessible Initial Comment: I've been trying to figure out a way to synchronize ajax calls instead of using Thread.sleep. I know it's possible to do it via HtmlUnit. However, the HtmlUnit API is not directly accessible via JWebUnit. I was wondering if it would be possible to give users of JWebUnit API direct access to HtmlUnit APIs. ---------------------------------------------------------------------- >Comment By: Jevon Wright (jevonwright) Date: 2010-03-10 19:49 Message: Upon actually trying NicelyResynchronizingAjaxController out, it turned out it was not possible to initialise the WebClient properly. SVN r827 adds the 'createWebClient()' protected method exposing this capability. It's not straightforward, but the correct way to now achieve the NicelyResynchronizingAjaxController in your XXXTestCase subclass is: public xxxTestCase() { // call super with a custom tester super(getCustomTester()); } private static WebTester getCustomTester() { return new WebTester() { @Override protected ITestingEngine initializeDialog() { HtmlUnitTestingEngineImpl engine = new HtmlUnitTestingEngineImpl() { @Override protected WebClient createWebClient() { WebClient wc = super.createWebClient(); wc.setAjaxController(new NicelyResynchronizingAjaxController()); return wc; } }; return engine; } }; } ---------------------------------------------------------------------- Comment By: SourceForge Robot (sf-robot) Date: 2009-12-15 15:20 Message: This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker). ---------------------------------------------------------------------- Comment By: Jevon Wright (jevonwright) Date: 2009-11-30 19:35 Message: You can now (in SVN r815) gain access to the current WebWindow and WebClient in the HtmlUnitTestingEngineImpl. That is, something like: WebTester wt; ((HtmlUnitTestingEngineImpl) wt.getTestingEngine()).getWebClient(); For the example above with a new WebClient, you would need to do something like this (I think, not tested): 1. Create your own subclass of WebTester 2. Override initializeDialog() to create a new ITestingEngine 3. In this method, return a new HtmlUnitTestingEngineImpl(WebClient) ---------------------------------------------------------------------- Comment By: James Tse (jtse) Date: 2009-03-24 00:59 Message: There is the NicelyResynchronizingAjaxController (which may be an outdated approach): WebClient webClient = new WebClient(); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); And there's also HtmlUnit's ThreadManager.joinAll(long maxWaitMillis) (which is an experimental API): http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/ThreadManager.html#joinAll(long) It would be nice if there was a JWebUnit API call to do this but I think the API calls to do AJAX synch-ing in HtmlUnit is unstable (as in likely to change in the future). This is why I suggest exposing the HtmlUnit objects to give users of JWebUnit the option to use these bleeding edge features. Thanks :) ---------------------------------------------------------------------- Comment By: Jevon Wright (jevonwright) Date: 2009-03-23 12:48 Message: That is a good idea, how does HtmlUnit support synchronising with Ajax calls? Cheers :) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=497985&aid=2697234&group_id=61302 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ JWebUnit-development mailing list JWebUnit-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jwebunit-development