Monday, March 1, 2010

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.

1 comment:

  1. Perhaps you'd benefit from a restriction instantly after might have} been paid. Maybe holidays end result in|may find yourself in|can lead to} problematic ranges of gambling for you. The best times for a restriction are varied and particular person 카지노사이트 to each individual. BetBlocker permits you to plan upfront and put your block in place at the times you want it most. You can set up BetBlocker as many times, on as many units and on as many various platforms as you want.

    ReplyDelete