Hello,
I finally found out, that I have to add an http-header request field in
order to make the Python webserver react as expected. The following
works for HTMLUnit:

        final WebClient webClient = new
                     WebClient(BrowserVersion.INTERNET_EXPLORER_6_0);
        webClient.addRequestHeader("Accept-Language", "en-us,en;q=0.5");

Is there a way to add request header fields to WebTest requests?

Kind Regards
Matthias


-----Original Message-----
From: Pfau, Matthias 
Sent: Freitag, 25. April 2008 20:09
To: '[email protected]'
Subject: Testing a Python Application failes on invoke

Hello,
I just made my first steps using WebTest. I tried to test an Intranet
application after successfully configuring a proxy and running the
already delivered test. And I failed. I do not know why, but WebTest
(HTMLUnit) seems to send some kind of different requests to web servers
compared to Firefox or IE.

The server responds correctly to Firefox and IE whereas WebTest just
receives the following:
------
        500 Internal Server Error
        
        The server encountered an unexpected condition which prevented
it from fulfilling the request.
        
        Traceback (most recent call last):
          File "C:\Python23\lib\site-packages\cherrypy\_cprequest.py",
line 539, in respond
          File "C:\Python23\lib\site-packages\cherrypy\_cprequest.py",
line 110, in __call__
          File "C:\Program Files\Vertec\webgui\webtools.py", line 507,
in syncsessionwrap_
            res = wrapped(cherrypy._serving.request,
cherrypy._serving.response, cherrypy._serving.session, args, kw)
          File "C:\Program Files\Vertec\webgui\webtools.py", line 530,
in syncwrapper_
            return self.vtcapp.syncexec(func, args, kw)
          File "C:\Program Files\Vertec\webgui\webtools.py", line 457,
in sessionwrapper_
            langstr=cherrypy.request.headers['accept-language']
          File "C:\Python23\lib\site-packages\cherrypy\lib\http.py",
line 286, in __getitem__
        KeyError: 'Accept-Language'
        
        Powered by CherryPy 3.0.0beta2
------

I am having severe problems in understanding why Webtest aka HTMLUnit (I
tried HTTPUnit with the same result) receives a completely different
answer as FF and IE. They receive correctly rendered HTML. Does anyone
have an idea what could cause this? Is there a way around? The webserver
can only be reached via SSL from our intranet.

Thanks for your efforts!

Kind Regards
Matthias Pfau

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

Reply via email to