Writing Firefox plugin that clicks a button every x time

Hey Everyone,

I don’t know if this is the right place to ask this question, but is it easy to write a plug-in that clicks on a button with a certain ID? Every few seconds. Where should I start? :slight_smile:

Yes, it couldn’t be easier. It’s just a setInterval command.

function clickButton() {
    document.querySelector("#identifier").click();
}
const milliseconds = 2000; // 2 seconds

setInterval(clickButton, milliseconds);
1 Like

Is there a small tutorial where I can start with in the first place :)?

For writing a FF plugin?

Here’s a tutorial on creating bookmarklets that can help.

1 Like

Yes :slight_smile:

Thank you, but did I miss the link? :slight_smile:

No, that was my error. It’s still in the clipboard though.

Well it’s a large topic… ^^ but the MDN would certainly a good place to start:

The API is the same as for chrome extensions AFAIK, so you might check out those docs as well:

https://developer.chrome.com/extensions

(Being more of a chromium guy I have mostly consulted the latter myself, and they’re pretty good IMO – check the “Getting Started” tutorial.)

That said, I second @Paul_Wilkins’s suggestion to start with bookmarklets instead – a bookmarklet basically is to an extension as a shell script is to a full blown application. Another idea might be writing some simple user scripts for extensions such as grease / tamper monkey.

1 Like

As @m3g4p0p says, the API is the same as for Chrome extensions.

Be sure to stay away from any XUL -based tutorials (XUL is Mozilla’s XML-based language for building user interfaces), as XUL-based extensions have been deprecated and will likely not run in a current version of FF.

Yeah, second that. I wrote an (admittedly rather old) tutorial on Tampermonkey that will get you going, should you decide take that route.

But if it absolutely has to be a browser extension, check this out:

1 Like

This is kinda Awsome. I fixed the click thingy, with the basic tutorial :slight_smile:.
What if I want to have a simple menu where I can hang actions on. For example, click on a button with a specific ID?


Okay Found it in the documentation