Monday, March 15, 2010

Mechanize vs. Scrape:

In the process of automating functional tests, I have ran across another python library, mechanize, that looks to be very promising. Perhaps, even more so than scrape.py?

http://wwwsearch.sourceforge.net/mechanize/
http://stockrt.github.com/p/emulating-a-browser-in-python-with-mechanize/

So far it seems that the mechanize platform is more powerful, as it is able to handle complex tasks like managing a gmail inbox( see http://libgmail.sourceforge.net/ ).

My take so far is that scrape.py offers some nice features for validating that a given page has the tags and elements I am looking for. I'm still new to both of these libraries so if anyone out there has experience with both and could help nudge me in the right direction, it would be much appreciated.

Sunday, March 14, 2010

Google Apps Mail Accounts: ICanHaz Themes?

I have mail accounts through google apps on a few different domains and it drives me crazy that I cannot customize the theme as I can with gmail. So a simple workaround: use a free gmail account in tandem with any google apps account that you use enough to desire a theme.

Within a free gmail account, it is easy to send all mail through a different account; in this case, send mail from the google apps account. Then on the flip side, forward all mail into the google apps domain into the mailbox of the gmail account. Voila! Use the gmail account with all the power you're used to, and nobody will know....unless they see that logo has changed ;)

Monday, March 8, 2010

Installing the PIL: Mac OS X 10.6 and Python 2.6.4

In short, learn from others:

Install python manually: http://twitter.com/delagoya/status/9883676332

Setup PIL w/jpeg support in a virtualenv: http://breadandpepper.com/blog/2009/oct/2/django-development-snow-leopard/

And now you've got a top notch django dev env running py 2.6.4.

Tuesday, March 2, 2010

Al Gore ops in on climate change

An interesting post in the nytimes today from Al Gore continues to paint the doom and gloom scenario for the US if we don't act now to stop man made global warming.

http://www.nytimes.com/2010/02/28/opinion/28gore.html

I struggle every time I read any thing that states Carbon Dioxide is a pollutant. If I remember correctly, CO2 is a byproduct of human life.

Personally, I'm tired of the whole global warming debate and I think most people agree with the need to keep the environment clean and work towards energy independence.

Can we stop the doomsday predictions already and take a positive approach to improving our position on these issues?

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.