Firefox in Ubuntu : how to automate basic authentication password confirm dialog
Solution 1:
Try xdotool or IronAHK. I haven't used either of them, but they're basically tools for simulating mouse and keyboard events, which sounds like one way of solving your problem.
Edit: See the comments for the exact answer.
Solution 2:
For people coming from google:
The easiest way to prevent that annoying popup is to got to "about":config" and add a new integer entry:
Name: network.http.phishy-userpass-length
Value: 255
With this in place you can then use http://username:password@myserver/mypage
and there will be no confirmation boxes.
More information can be found at http://kb.mozillazine.org/Network.http.phishy-userpass-length
Solution 3:
There is an automation addon for firefox called iMacros.
I have not used it first hand and cannot vouch it it will help you solve your problem.
You could give it a short try.