scrape.py for functional website testing

This solution is perfect for testing your website’s functional capabilities. Scrape.py supports sessions and cookies so hitting your authenticated resources is cake.

Here’s a quick sample i wrote to test things out:

from scrape import *
s.go(“http://www.google.com”)
s.follow(“Sign in”)
x = s.doc.first(‘form’)
params = x.get_params()
params[‘Email’]=’keithentzeroth’
params[‘Passwd’]=’xxxxxx’
s.submit(x,params)
s.go(“http://www.google.com”)
print s.doc

Try it out with your google account. To verify you’re logged in look for the Sign Out link or alternatively look for a GAUSR cookie in s.cookiejar.

Thanks to Ka-Ping himself for clearing up some of my confusion.

My plan is to use this to test the site as if there were no script/styles enabled. Then to layer on browser behavior ( AJAX etc…), I’ll look to Selenium or something of the kind.