SlimerJS runs on any platform on which Firefox or XulRunner is available. XulRunner is the core of Firefox without its user interface.
To install SlimerJS, you need to download its package. Three flavors:
A package is available for Arch Linux, thanks to a contributor. So if you use Arch Linux just type in a terminal:
yaourt slimerjs
It will install all needed packages. You’re ready to use SlimerJS. You can jump to the Lauching SlimerJS section.
Download the zip or the gz package of SlimerJS from the web site and extract files into a directory somewhere on your disk. You’ll have a slimerjs/ directory with some files. Everything is here. You’re ready to use SlimerJS. Go to the Lauching SlimerJS section.
Download the zip package of SlimerJS from the web site and extract files into a directory somewhere on your disk. You’ll have a slimerjs/ directory with some files.
Then you need to install Firefox or XulRunner if it is not already done.
To finish the installation, you probably should read the following section before launching SlimerJS.
During its launch, SlimerJS tries to discover itself the path of Firefox or XulRunner. This is not a problem for the Standalone edition or linux packages.
In case it fails (this could be the case for the lightweight edition), or if you want to launch SlimerJS with a specific version of Firefox, you should create an environment variable containing the path of the Firefox/XulRunner binary. To create this environment variable from a command line:
export SLIMERJSLAUNCHER=/usr/bin/firefox
SET SLIMERJSLAUNCHER="c:\Program Files\Mozilla Firefox\firefox.exe
export SLIMERJSLAUNCHER="/cygdrive/c/program files/mozilla firefox/firefox.exe"
export SLIMERJSLAUNCHER=/Applications/Firefox.app/Contents/MacOS/firefox
You can of course set this variable in your .bashrc, .profile or in the computer properties on Windows.
From a command line, call the slimerjs executable (or slimerjs.bat for Windows) with the path of a javascript file.
/somewhere/slimerjs-1.2.3/slimerjs myscript.js
On Windows:
c:\somewhere\slimerjs-1.2.3\slimerjs.bat myscript.js
The js script should contain your instructions to manipulate a web page...
You can indicate several options on the command line. See the “configuration” chapter.
There is a tool called xvfb, available on Linux and MacOS. It allows to launch any “graphical” programs without the need of an X-Windows environment. Windows of the application won’t be shown and will be drawn only in memory.
Install it from your prefered repository (sudo apt-get install xvfb with debian/ubuntu).
Then launch SlimerJS like this:
xvfb-run ./slimerjs myscript.js
You won’t see any windows. If you have any problems with xvfb, see its documentation.