npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-selenium-webdriver-master

v0.2.532

Published

Starts and stops selenium in webdriver or hub mode for use with 3rd party CI platforms where phantomjs / chromedriver can have issue with selenium

Downloads

8

Readme

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

This plugin requires Grunt ~0.4.2

If 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:

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

Three tasks are added (selenium_start, selenium_stop and selenium_phantom_hub). The tasks do not require or set any options

Overview

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

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: {
        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

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

Starts a selenium local server on http://127.0.0.1:4444/wd/hub 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

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

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?

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).

Phantom 2

Phantom 2 is not currently supported due to a bug with ghostdriver - https://github.com/detro/ghostdriver/issues/394

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.

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