Write scripts to do commands on firefox or chrome

I am going through a discussions forum and am trying to download each page as I search through the discussions that I am looking for. This is my process:

  1. Ctrl + f and type in 003 :Discussions that have 003 in the name are highlighted on the page.

  2. Ctrl + left click : open up a new tab for a discussion with 003 in it

  3. Ctrl + s and enter : save the tab

  4. Ctrl + w : closes the tab

It is tedious and am wondering if it’s possible to write a script to help automate the process. I figured it’s reasons like this that people start to code .. automation and making our lives easier. If anyone has any ideas or tips please share. Have a feeling that javascript can be used to accomplish this but I am just guessing.