founddrama / phantomjs-cookbook

The code for the recipes in the PhantomJS Cookbook.

Home Page:https://www.packtpub.com/product/phantomjs-cookbook/9781783981922

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The PhantomJS Cookbook

This repository is the sample code that goes along with the book The PhantomJS Cookbook. The book is a deep-dive into PhantomJS, its core APIs, and the eco-system of testing tools that have sprung up around it.

PhantomJS Cookbook cover

What's here?

The chapters break down as follows:

  1. Getting Started with PhantomJS
  2. The PhantomJS Core Modules
  3. Working with webpage Objects
  4. Unit Testing with PhantomJS
  5. Functional and End-to-End Testing with PhantomJS
  6. Network Monitoring and Performance Analysis
  7. Generating Images and Documents with PhantomJS
  8. Continuous Integration with PhantomJS

What do you need?

Here is what you'll need to run the recipes:

  • PhantomJS - (version 1.9 or greater) "the headless WebKit"; you will need this for every recipe.
  • Node.js - (version 0.10.2 or greater) to run the phantomjs-sandbox demo app that most of the recipes reference.
  • Java - (Java SE Runtime Environment 1.7.0_45 or greater) for a couple of the recipes (especially those involving Selenium); and on that note:
    • Selenium version 2.39.0 or greater; and
    • Maven version 3.0.9 or greater.
  • Ruby - (version 1.9.3 or greater) for the recipes that involve Capybara and Poltergeist.
  • Python - (version 2.6 or greater) for the recipes that involve CasperJS.

And what else?

If you are following along from the book, then you may also want to pick up and install the following as well:

How do I get started?

Once you have cloned this repository and installed the above software, the only other things you might need to do:

  1. Expose PHANTOMJS_SOURCE as a variable in your shell. Remember the path where you cloned the PhantomJS source code? Export that to your shell as PHANTOMJS_SOURCE.
  2. Install the Node.js modules for the demo app. cd into this repo's phantomjs-sandbox directory and install the Node.js dependencies with npm install
  3. Get YSlow as a submodule. If you're unfamiliar with this process, cd into the project's directory and enter: git submodule init && git submodule update
  4. ...and you're done.

Licenses

Let's do this informally, so it's easier for everyone:

  1. Everything in here that I wrote (short version: the recipes) is under the MIT license.
  2. I tapped into the wonderful open source community and used a bunch of awesome tools for a bunch of these recipes; in those cases (short version: most of the stuff in the lib directory) I tried to include their existing licenses because I recognize those items as their intellectual property and want to respect that and properly credit them.
  3. If you believe that I'm including something here in violation of its license agreement, please contact me and give me the chance to make it right.

About

The code for the recipes in the PhantomJS Cookbook.

https://www.packtpub.com/product/phantomjs-cookbook/9781783981922


Languages

Language:JavaScript 96.7%Language:CSS 1.1%Language:EJS 0.9%Language:HTML 0.8%Language:Ruby 0.2%Language:Java 0.2%Language:Shell 0.1%