I managed to make it works with the following code:
getTestingEngine().setThrowExceptionOnScriptError(false); // Ignore
JavaScript errors and continue loading of the page
beginAt("/");
Thread.sleep(10000); // Wait for all AJAX/JS stuff to be completed
// Another option is to use HTMLUnit specific API but it makes your test
not portable:
// ((HtmlUnitTestingEngineImpl)
getTestingEngine()).getWebClient().waitForBackgroundJavaScript(10000);
// A last option would be to wait until page title is what you expect (with
a timeout)
// Here I think we could have a bug in JWebUnit as the title of the
page is "Twitter Button" so I think the context page is wrong and point
to an IFrame
// The workaround is to force JWebUnit to go to the top level window
gotoRootWindow();
assertTitleEquals("UAE - UAE Business & Financial News, Investment News &
Research - Middle East - Zawya");
++
Julien
>________________________________
> De : George H <[email protected]>
>À : Julien HENRY <[email protected]>; Usage problems for JWebUnit
><[email protected]>
>Envoyé le : Vendredi 18 janvier 2013 10h11
>Objet : Re: [JWebUnit-users] Using JWebUnit on coldfusion pages
>
>
>Thanks for the quick reply.
>
>
>The site I am testing is http://www.zawya.com/middle-east/countries/uae/
>And for now I am doing a very simple test case of just checking the title
>
>
>@Before
>public void prepare() {
>setTestingEngineKey(TestingEngineRegistry.TESTING_ENGINE_HTMLUNIT);
>setBaseUrl("http://www.zawya.com/middle-east/countries/uae";);
>}
>@Test
>public void testTitle() {
>beginAt("/");
>assertTitleEquals("UAE - UAE Business & Financial News, Investment News &
>Research - Middle East - Zawya");
>}
>
>
>Running this gives me an exception (see attachment)
>
>
>When I run JWebUnit on a simple site that has .html pages it all works fine.
>But on a coldfusion page like the one mentioned it doesn't. Wondering if I
>will get issues on GWT based sites as well.
>
>
>--
>George H
>[email protected]
>
>
>On Fri, Jan 18, 2013 at 10:29 AM, Julien HENRY <[email protected]> wrote:
>
>Hi George,
>>
>>I don't know Coldfusion but I read it produces 100% html so there is no
>>reason why JWebUnit could not parse it. Could you please send us a sample
>>html page produced by coldfusion as well as the JWebUnit code you are using
>>to access it.
>>
>>Regards,
>>
>>Julien
>>
>>
>>>________________________________
>>> De : George H <[email protected]>
>>>À : [email protected]
>>>Envoyé le : Vendredi 18 janvier 2013 8h18
>>>Objet : [JWebUnit-users] Using JWebUnit on coldfusion pages
>>
>>>
>>>
>>>Hi, I tried out jwebunit on regular websites and it works very well, I
>>>really liked it.
>>>I'm having problems trying to use it on websites developed using coldfusion
>>>8. Some of the pages are .cfm and some don't show any page extension.
>>>Eitherway when I run JWebUnit on it all my test cases fail showing that
>>>either elements are not present or that values, like Title are empty.
>>>
>>>
>>>Is this an issue of support or is there some trick to get it working?
>>>
>>>
>>>Thanks.
>>>
>>>--
>>>George H
>>>[email protected]
>>>------------------------------------------------------------------------------
>>>Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
>>>much more. Get web development skills now with LearnDevNow -
>>>350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
>>>SALE $99.99 this month only -- learn more at:
>>>http://p.sf.net/sfu/learnmore_122812
>>>_______________________________________________
>>>JWebUnit-users mailing list
>>>[email protected]
>>>https://lists.sourceforge.net/lists/listinfo/jwebunit-users
>>>
>>>
>>>
>>
>>------------------------------------------------------------------------------
>>Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
>>much more. Get web development skills now with LearnDevNow -
>>350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
>>SALE $99.99 this month only -- learn more at:
>>http://p.sf.net/sfu/learnmore_122812
>>_______________________________________________
>>JWebUnit-users mailing list
>>[email protected]
>>https://lists.sourceforge.net/lists/listinfo/jwebunit-users
>>
>
>
>
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
JWebUnit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users