me again.... I took a look at JavaScriptEngine.java in the htmlunit 1.14 codebase to see what was breaking for clues and it's in a section specifically for non-IE browsers. So I switched the User-Agent string (I was using Mozilla for some other reason on another test) and now things work just fine...

I saw references to a similar bug for PDF supposedly fixed in HtmlUnit 1.14 (for Mozilla browsers) but I guess XLS files are processed differently

eagerly awaiting WebTest with HtmlUnit 2.0  :)

any heuristics or something for using one browser to do X and another browser for Y?

doug


drf wrote:
Hi all,

  well, I must say I'm a little disappointed right now - when I came
across WebTest, it seemed like the perfect solution to my problem... :)
But one simple test later and I can't get it to download a XLS file. I'm
lost as to what the problem might be - I searched the list archives for
clues...  I found some reference to a groovy thing / snippet by Marc
(http://lists.canoo.com/pipermail/webtest/2007q3/008365.html) to manage bad
Content-Type headers

Q: how would I insert that code into the mix to get WebTest to behave
differently?   I just need a pointer to some docs

but I am not faced with that problem in this instance....

These are the particulars:

the test that fails (all of it):

<enableJavaScript enable="false" />
<invoke url="http://schedule.otal.com/Schedule/Downloads/21748/webotal/OTAL
SB.xls" />


Stack trace:

[config] INFO (com.canoo.webtest.engine.Configuration) - Configuring 1
HTTP header field(s)
   [config]  INFO (com.canoo.webtest.engine.Configuration) - Skipped
User-Agent header as it has already been configured in the BrowserVersion
   [config]  INFO (com.canoo.webtest.engine.Configuration) - set option
<JavaScriptEnabled> to value <false>
    [steps]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: steps
"Implicit <steps> task" (1/3)
[enableJavaScript] INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
enableJavaScript (1/3)
[invoke] INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: invoke
(2/3)
[invoke] INFO (com.canoo.webtest.steps.request.TargetHelper) - getting
response for url:
http://schedule.otal.com/Schedule/Downloads/21748/webotal/OTAL SB.xls
   [invoke] ERROR
(com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine) - Exception
while initializing JavaScript for the page
   [invoke] java.lang.ClassCastException:
com.gargoylesoftware.htmlunit.UnexpectedPage
   [invoke]     at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.init(JavaScriptEngine.java:225)
   [invoke]     at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.access$000(JavaScriptEngine.java:96)
   [invoke]     at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$1.run(JavaScriptEngine.java:156)
   [invoke]     at org.mozilla.javascript.Context.call(Context.java:577)

wget shows that the headers come out ok (as XLS):

 HTTP/1.1 200 OK
  Server: Microsoft-IIS/5.0
  Connection: keep-alive
  Date: Sat, 12 Apr 2008 23:23:15 GMT
  Content-Type: application/vnd.ms-excel
  Accept-Ranges: bytes
  Last-Modified: Sat, 12 Apr 2008 01:54:19 GMT
  ETag: "3e426e1f409cc81:eac"
  Content-Length: 84992
Length: 84,992 (83K) [application/vnd.ms-excel]


I have no idea where to go from here or what to check. I'm running things
on a Mac (OS X 10.4) if that is a factor...

thanks
doug


_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest


_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to