I need to write some scripts that access some websites. A script from command line would get some pages, post some forms, screen scrap some information etc.
It cannot really be a library "browser" like libwww-perl because some steps might require user interactions (captchas, ajax-only forms, any interaction surprises etc).
The most practical way I can think of would be remotely opening a tab in Firefox, and injecting Javascript into it, something a bit like what Greasemonkey and Selenium do. It doesn't necessarily have to be for Firefox, can be a different browser if that's easier.
So what would be the best way to do that?