sethmcl/phantomjs-node — pull request #1 by sethmcl (2012-07-11 12:16:05+00:00)
Title: Custom binary name name

This patch allows the user to specify where to find the phantomjs
executable, rather than forcing the use of the 'phantomjs' executable
which is in the path.

For example, let's say you have two versions of phantomjs installed at
these locations:

`/home/user/tools/phantomjs/v1.3/bin/phantomjs`
`/home/user/tools/phantomjs/v1.6/bin/phantomjs`

You can choose whether you want to use version 1.3 or 1.6 when calling
phantom.create() with a new, optional, parameter:

```javascript
phantom.create(cb, '/home/user/tools/phantomjs/v1.6/bin/phantomjs')
```

If this parameter is not specified, then a default of 'phantomjs' will
be used (which will just use whichever phantomjs binary is in your
path).

__Example usage__
```javascript
// using the new parameter
var pathToPhantomJsBinary = '/home/user/tools/phantomjs/v1.6/bin/phantomjs';

phantom.create(function(ph) {
return ph.createPage(function(page) {
return page.open(loadUrl, function(status) {
return page.evaluate((function() {
return document.title;
}), function(result) {
return ph.exit();
});
});
});
}, pathToPhantomJsBinary);

// default behavior still works
phantom.create(function(ph) {
return ph.createPage(function(page) {
return page.open(loadUrl, function(status) {
return page.evaluate((function() {
return document.title;
}), function(result) {
return ph.exit();
});
});
});
});
```