[twill] Get the error from a 500 page

Samuel Newman samnewman at google.com
Tue Oct 23 16:23:36 PDT 2007


The problem is that the html is empty - I can get the browser, I can
get the title & URL, but I cannot get the body. I think this is
because mecahnize is bombing on the 500, so the result  doesn't get
the HTML body, just the headers.

On 10/23/07, Terry Peppers <peppers at gmail.com> wrote:
> Sam -
>
> Maybe something like this:
>
> [terryp@ ] terryp :: python
> >>> from twill.commands import *
> >>> go("http://www.swordstyle.com/test/simulate.php")
> ==> at http://www.swordstyle.com/test/simulate.php
> 'http://www.swordstyle.com/test/simulate.php'
> >>> code("200")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/twill-0.9b1-py2.4.egg/twill/commands.py",
> line 128, in code
>     raise TwillAssertionError("code is %s != %s" % (browser.get_code(),
> twill.errors.TwillAssertionError: code is 500 != 200
> >>> result = get_browser().get_html()
> >>> print result
> <html><head><title>Foo</title></head><body>Foobar</body></html>
> >>>
>
> _______________________________________________
> twill mailing list
> twill at lists.idyll.org
> http://lists.idyll.org/listinfo/twill
>


-- 
sam
Test Mercenaries Blog: http://big.corp.google.com/~mstriebeck/testmercenaries/



More information about the twill mailing list