There are some differences between SlimerJS and PhantomJS 1.9.x although we tried to implement the same behaviors of PhantomJS APIs.
Many of differences come from differences between these two web platforms, Webkit and Gecko. So we couldn’t suppress these differences in SlimerJS. There are also some few differences that exist in the API because it was our choice.
So here are some of these differences. This list is not exhaustive of course! We found most of them during the port of CasperJS on SlimerJS.
The main script is considered as a module, for more security and to be compatible with Mozilla modules. So this is not window and there is an exports object.
webpage.sendEvent() for key events is more consistent. In PhantomJS, there are several issues.
webpage.open() returns a promise. It’s easier to chain things executed asynchronously
The call of webpage.open() (or openUrl()), in PhantomJS, ends when the load is starting. But in SlimerJS it ends almost immediately because it should open a real window before the loading and it is done asynchronously. So probably some properties will not be available immediately after the call of open() in SlimerJS.
It seems that the call of listeners during the page loading is not done at the same step between PhantomJS and SlimerJS. Implementation in PhantomJS is a bit obscure.
webpage.open() and openUrl() support only “GET” and “POST” operation in SlimerJS, no “PUT” nor “DELETE” operations.
The webserver object has more methods to configure it easily
PhantomJS has a strange behavior on fs.read() : it seems it reads files always as binary files. However SlimerJS’s fs.read() strictly respect the ‘b’ flag parameter.
the call of these methods. You can use slimer.isExiting() to control your processing.
The callback webpage.onNavigationRequest receives bad parameters. Don’t rely on the navigationType and the isMainFrame values (because of some limitations in the Gecko API).
Callbacks webpage.onLoadStarted and webpage.onLoadFinished receive additional parameters in SlimerJS (the url, a boolean indicated if it is in a frame...)
You can output binary content on the standard output stream (weither with fs.open('/dev/stdout'), webpage.render('/dev/stdout') or system.stdout)
Some few PhantomJS features are still missing in SlimerJS. See release notes.