Testing HTTP Status Codes (Selenium)
I'm just getting started learning how to use Selenium for testing web apps and I was a bit shocked to find that access to the HTTP status code was not possible (since 2009!).
http://code.google.com/p/selenium/issues/detail?id=141
This seems to get the job done as a workaround:
import urllib2
class MyunmTestCase(unittest.TestCase):
def test_something(self):
request = urllib2.urlopen("http://google.com")
self.assertEqual(request.getcode(), 200)
...
Not sure how 'pro' this is but it works for me for now.
Written by Jonahlyn
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Related Tags
#python
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#