Book Image

PhantomJS Cookbook

By : Rob Friesel
Book Image

PhantomJS Cookbook

By: Rob Friesel

Overview of this book

Table of Contents (15 chapters)
PhantomJS Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Listing CSS properties


This recipe introduces the confess.js library and demonstrates how to use it to identify which CSS properties are being used on a page.

Getting ready

To run this recipe, we will need a target URL for a website that uses CSS.

We will use the confess.js script to analyze the site and produce a report of the CSS properties used on the page.

Note

The confess.js library is an open source project by James Pearce that provides several performance-related tasks to run under PhantomJS. At this time, confess.js does not currently have a copyright license listed in the repository; however, it can be obtained on GitHub at https://github.com/jamesgpearce/confess.

After downloading the confess repository, we want to place it in the lib directory of our downloadable sample code repository. Note that if we download the .zip archive of the repository, we may need to rename the folder from confess-master to confess.

Lastly, the script in this recipe runs against the demo site that is included...