There is a cool Firefox add-on that exports as well as imports saved usernames and passwords in Mozilla Firefox.
(In case you use a public or shared computer, do ensure that you never use the Remember password feature in Firefox while logging to sites as a security measure. )
1. Download and install the Password Exporter add-on from here.
2. Once the add-on is installed, go to Options / Preferences > Security > Passwords > Import / Export Passwords.
3. If you want to export the saved usernames and passwords, it is a good idea to first select the “Obfuscate Usernames/Passwords” and then click the Export Passwords.
4. This gives a choice to whether save it as a csv or xml file. Save it as per preferences somewhere safe.
5. This same file can now be used to import the saved credentials by the Import Passwords button.
Pretty useful add-on, here is the website of the developer who made this.