Formatters in the Selenium-IDE context are what lets you record or export in a particular language. The default is Selenese (HTML), but Se-IDE also ships pretty decent variety out of the box as well. They are very important to the success of rolling out Selenium in an organization by letting you record in Se-IDE and then modify the script in some sort of Se-RC client.

But what if you are a business, or even another open source project that leverages Selenium with some sort of unique bit of vendor/product-script? You could create a formatter, post it on your website and have people load it into their browsers, sure. Or, you could distribute it as a plugin which lets you update it when bugs are fixed in it and track its download and usage.

Selenium-IDE (as of about half an hour ago) has support to let you do the latter. And here is how you add in your formatter. How you create a formatter, well, that is something for another time.

Most of this should be old hat by now.

Add to the chrome.manifest

# custom format(s)
overlay chrome://selenium-ide/content/selenium-ide-overlay.xul chrome://preflight/content/formats/format-loader.xul

And create the overlay

<?xml version="1.0"??><?xml-stylesheet href="chrome://global/skin/" type="text/css"??><overlay id="preflight_format_loader_overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"><script src="chrome://selenium-ide/content/api.js" type="application/x-javascript"></script><script src="chrome://preflight/content/preflight.js" type="application/x-javascript"></script><script type="application/javascript">
        var ide_api = new API();
        ide_api.addPluginProvidedFormatter("preflight", "Preflight Formatter", "chrome://preflight/content/formats/preflight-formatter.js");
    </script></overlay>

The arguments for addPluginProvidedFormatter() are as follows:

  • The id of the formatter. This is used internally.
  • The name of the formatter. This is what the user sees.
  • The chrome url of the formatter.

And of course we want to cleanup after ourselves. Add this to the quit-application section of your observer (that was started in part 4).

var current_ppf = branch.getCharPref("pluginProvidedFormatters");
if (typeof current_ppf != "undefined") {
    var split_ppf = current_ppf.split(",");
    for (var ppf = 0; ppf 
<p>
Now, let's start getting those formats in there. I'm looking at you <a href="http://chrismcmahonsblog.blogspot.com/2009/12/selenesse-nee-webtest.html">Selenesse</a>.<br></br><br></br>
Update 1/12/2010 - changed the token you split on from a ; to a , in the observer</p>
<script charset="utf-8" src="http://feeds.feedburner.com/~s/user?i=http://adam.goucher.ca/?p=1352" type="text/javascript"></script>