HTMLUnit and DWR

The last nite I was trying to write down some unit/integration tests using htmlunit embedded in TestNG.
While for simple pages this was quite neat, I have a page using DWR for filling some select elements (triggered by page onload and then onchange events). Here i faced a set of problems to which unfortunately i wasn’t able to find a solution:

  • the htmlunit XMLHttpRequest doesn’t solve the src attribute and after this a NPE occurs in jsxFunction_open
    I have patched this by making HtmlScript.getSrcAttribute solve the complete URL
  • the 2nd problem was that again htmlunit could not solve the dynamic generated call of DWR: DWREngine._execute […]
    I’ve been able to patch this too by making the DWRServlet use the complete URL for the dynamic call
  • the 3rd and final problem – the unsolved one was that htmlunit XMLHttpRequest.jsxFunction_send is expecting as a result a text/xml that must be an XmlPage

I would really like to have this test working so if any of the readers can enlighten me how to fix this or I have the luck that one of the developers will read this, it would be really really great.

2 Comments

Filed under Uncategorized

2 responses to “HTMLUnit and DWR

  1. Joe Walker

    It would be interesting to see what you needed to do to DWR to fix the issue with HTMLUnit. If it is fairly non-intrusive then I’ll add your changes in for the next version.

    Someone on the server-side thread on DWR was having just this issue.

  2. Anonymous

    Check the HTMLUnit sourceforge page under the patches section and apply both of the patches to the latest from CVS. That should fix both the relative URL’s problem and the strictness of content type problem.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s