You can use bookmarklets to do exactly what you're talking about: Running JavaScript in the context of the current window from a bookmark. Bookmarklets need to be fairly short and can be a pain to write (because they're javascript URLs, and so need to be URL-encoded), but you can use a bookmarklet to bootstrap an external script (written normally) into the page and then just call functions in that script, which minimises how much actual bookmarklet code you have to write. More about doing that (including an example) in this answer here on SO.
But in terms of testing: Presumably the UI is underpinned by logic code, it's worth having unit tests for that. There are also unit testing frameworks specifically for web applications that you can use for testing UI features; see this SO question/answer for more. The one you seem to hear about most right now is Selenium.
A couple of others have mentioned GreaseMonkey, and in FF that's certainly an option. The nice thing about bookmarklets is that they work in a wide range of browsers.