WWW::Selenium has already been recommended. Also check the Selenium homepage for details of the firefox plugin available for it. I have found that tool is the way to go when it comes to automating complex web interactions.