Home - mozrepl - GitHub http://wiki.github.com/bard/mozrepl
Doesn't look like you can automate it, though that would be awesome
another firefox repl plugin
A firefox java script REPL (uses telenet).