[twill] Get the error from a 500 page

Terry Peppers peppers at gmail.com
Tue Oct 23 14:36:22 PDT 2007


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>
>>>



More information about the twill mailing list