Preface

PhantomJS is a fully scriptable headless browser. When I started using it two years ago, I thought it was just another environment that can perform and evaluate JavaScript, but, as I explored its features, to my surprise, I found it to be an awesome technology. Most of the features that are discussed in this book come from the bits and pieces of the application that I have been using in my work to create a web monitoring and user-simulation type of service. PhantomJS is one of those technologies that can be integrated into any existing platform and can solve web development puzzles, ranging from page manipulation to user event simulation.

This book is a guide to help you not only ease your way into developing scripts in PhantomJS but it will also show you the cool features of this technology. In addition, it will also encourage you to be more creative and play with it as each chapter unfolds new capabilities. This book will help you get started.

What this book covers

Chapter 1, Getting Started, starts by introducing what PhantomJS is, how to get and install it, and then goes directly into creating your very first script.

Chapter 2, Manipulating Page Content, shows you how to directly interact with pages that we open in our headless browser.

Chapter 3, Handling Events and Callbacks, explores how to capture events that web pages generate for the browser and reacts accordingly. We will also simulate browser events that involve simulating the users' mouse and keyboard events.

Chapter 4, Capturing Errors, focuses on how to handle errors within PhantomJS and those that are generated by the pages.

Chapter 5, Grabbing Pages, plays with one cool feature of PhantomJS, that is, capturing screenshots programmatically.

Chapter 6, Accessing Location-based Services, focuses on using existing web-based and location-based services. Using PhantomJS as our headless browser, we will be capturing location data and creating examples that are useful.

Chapter 7, Working with Files, shows you how to work with files and understand how these are supported by PhantomJS using its own FileSystem API.

Chapter 8, Cookies, discusses how cookies are supported by PhantomJS. We will learn to create cookies and interact with the pages that need them.

Chapter 9, External JavaScript, addresses the subject of working with external JavaScripts and shows how we can create PhantomJS modules that can be re-used in every script.

Chapter 10, Testing with PhantomJS, focuses on the use of PhantomJS for testing. We will learn how to use Jasmine, create test scripts, and make them work using PhantomJS.

Chapter 11, Maximizing PhantomJS, goes over the different products that are written using PhantomJS and shows how we can go beyond what we've learned from the books to make our own applications.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.50.206