PHPackages                             kfts/grunt-selenium-webdriver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. kfts/grunt-selenium-webdriver

ActiveLibrary

kfts/grunt-selenium-webdriver
=============================

Utils for starting and stopping selenium in 3rd party environments.

041JavaScript

Since Feb 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/kfts/grunt-selenium-webdriver)[ Packagist](https://packagist.org/packages/kfts/grunt-selenium-webdriver)[ RSS](/packages/kfts-grunt-selenium-webdriver/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

grunt-selenium-webdriver
========================

[](#grunt-selenium-webdriver)

> Starts and stops selenium in webdriver or hub mode, works with 3rd party CI platforms

We wrote this after extensive problems getting selenium webdriver tests to run in all local and 3rd party environments. If you are using circleci and want to run headless tests then the selenium\_phantom\_hub task will do the trick.

Note that we have found problems with selenium and bundled chromedriver but at the current time we do not have an option to start chromedriver in the same way as phantomjs. Our advice is use firefox and phantom for CI testing and saucelabs / local for the rest.

Getting Started
---------------

[](#getting-started)

This plugin requires Grunt `~0.4.2`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```
npm install grunt-selenium-webdriver --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```
grunt.loadNpmTasks('grunt-selenium-webdriver');
```

The "selenium\_webdriver" tasks
-------------------------------

[](#the-selenium_webdriver-tasks)

Three tasks are added (selenium\_start, selenium\_stop and selenium\_phantom\_hub). The tasks do not require or set any options

### Overview

[](#overview)

```
    grunt.loadNpmTasks('grunt-selenium-webdriver');
    grunt.registerTask('e2e', [
        'selenium_phantom_hub',
        'mocha_e2e',
        'selenium_stop'
    ]);
```

### options

[](#options)

You can set various selenium commandline options. Some environments already have an instance running on 4444, in which case set the port in your grunt config:

```
    selenium_start: {
        local: {
            options: { port: 4445 }
        }
    },
```

You can see we do this in our tests, have a look at our GruntFile setup for the plugin. The options are:

- host
- port
- timeout
- maxSession
- phantomPort
- firefoxProfile
- displaySeleniumLog

### Usage Examples

[](#usage-examples)

This task is designed to be used in conjunction with your test runner of preference. The server is destroyed when grunt exists so grunt start\_selenium will only make a server available to other grunt tasks. If you need a task that persists the selenium server then try grunt-selenium-standalone.

If you look in the plugin you can see an example of a mocha test that uses using the raw selenium-webdriver node module. This project also works with protractor.

#### selenium\_start

[](#selenium_start)

Starts a selenium local server on  with all browsers in PATH available, including phantom. However, if you get errors with test run using default phantomjs try the task below.

#### selenium\_phantom\_hub

[](#selenium_phantom_hub)

starts a selenium grid hub and attaches phantomjs to it for headless testing, only one client is available in this configuration

#### selenium\_stop

[](#selenium_stop)

stops whichever server was started, if you need to change from headless to normal mode then you will need to stop first

Problems?
=========

[](#problems)

The reason for this project is there are inconsistencies between the location of files on different environments. If you hit a problem

```
cd node_modules/grunt-selenium-webdriver
npm install
grunt test --trace

```

This should give you some info about your system and relative paths etc. There are also some additional commented out console statement in the tasks file you can enable. If you can't fix the problem from here please send us this info on your support ticket along with any platform details (eg AWS, Travis etc).

Contributing
------------

[](#contributing)

Please fix any bugs you find and add any new cases not covered, pull requests gratefully received.

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).

Release History
---------------

[](#release-history)

```
0.2.432 support for node 0.12
0.2.422 phantomPort option added
0.2.421 added some mocha tests + improved branching logic separated for phantom and selenium components
0.2.420 release using selenium-server-standalone-2.42.2.jar
0.2.391 initial release using selenium-server-standalone-2.39.0.jar
0.2.392 will have theses documentation updates
0.2.450 release using selenium-server-standalone-2.45.0.jar
0.2.451 adds --ignore-ssl-errors to phantomjs startup
0.2.461 release using selenium-server-standalone-2.47.1.jar
0.2.482 release using selenium-server-standalone-2.48.2.jar
0.2.501 release using selenium-server-standalone-2.50.1.jar
0.2.530 release using selenium-server-standalone-2.53.0.jar
0.2.531 added firefoxProfile and displaySeleniumLog options

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 57.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1bc08638edd08f1488ac50bee1a46a3fe16a3ce3bd44b29db5c15b25b67a561?d=identicon)[kfts](/maintainers/kfts)

---

Top Contributors

[![kfts](https://avatars.githubusercontent.com/u/17014086?v=4)](https://github.com/kfts "kfts (8 commits)")[![haavardw](https://avatars.githubusercontent.com/u/95774?v=4)](https://github.com/haavardw "haavardw (1 commits)")[![jjgonecrypto](https://avatars.githubusercontent.com/u/799038?v=4)](https://github.com/jjgonecrypto "jjgonecrypto (1 commits)")[![cobrowserAlex](https://avatars.githubusercontent.com/u/10495775?v=4)](https://github.com/cobrowserAlex "cobrowserAlex (1 commits)")[![lorden](https://avatars.githubusercontent.com/u/1326808?v=4)](https://github.com/lorden "lorden (1 commits)")[![ryankinal](https://avatars.githubusercontent.com/u/35668?v=4)](https://github.com/ryankinal "ryankinal (1 commits)")[![sholladay](https://avatars.githubusercontent.com/u/3674950?v=4)](https://github.com/sholladay "sholladay (1 commits)")

### Embed Badge

![Health badge](/badges/kfts-grunt-selenium-webdriver/health.svg)

```
[![Health](https://phpackages.com/badges/kfts-grunt-selenium-webdriver/health.svg)](https://phpackages.com/packages/kfts-grunt-selenium-webdriver)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
