Start PhantomJS web driver.
npm install grunt-phantom> Start PhantomJS web driver.



~0.4.1If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
``shell`
npm install grunt-phantom --save-dev
The plugin assumes you have PhantomJS installed globally. If you do not wish to have it installed globally, you can install it as an optional dependency:
`shell`From your project's root directory
cd node_modules/grunt-phantom/
npm install --optional
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks('grunt-phantom');
to the data object passed into grunt.initConfig().`js
grunt.initConfig({
phantom: {
options: {
port: 4444
},
your_target: {
},
another_target: {
options: {
port: 5555
}
}
}
})
`$3
#### port
Type:
Number
Default value: 4444The web driver port in PhantomJS. Effectively:
phantomjs --webdriver=4444
$3
#### Default Options
In case you want to use the default 4444 port, you can omit the
port option. Otherwise, if you want to use a different web driver port, set it like this:`js
grunt.initConfig({
phantom: {
options: {
port: 5555
},
cucumber: {
}
}
})
`#### Multiple PhantomJS instances
If you need to run multiple web drivers, you can have multiple targets:
`js
grunt.initConfig({
phantom: {
options: {
port: 5555
},
cucumber: {
},
mocha: {
options: {
port: 6666
}
}
},
})
`Here, if you run
grunt phantom, two web drivers will be launched, cucumber on port 5555 and mocha on port 6666.#### PhantomJS Output
If you want to see the output of PhantomJS, pass
--debug option to your grunt command:`shell
grunt phantom --debug
``