更新时间:2021-11-12 16:29:47
coverpage
Getting Started with PhantomJS
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files eBooks discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Chapter 1. Getting Started
Downloading PhantomJS
Building PhantomJS from source
Working with PhantomJS
PhantomJS JavaScript API
The phantom object
The command-line arguments
Writing PhantomJS scripts
Summary
Chapter 2. Manipulating Page Content
Opening a web page
Playing with DOM elements
Simulating mouse clicks
Working with form fields
Chapter 3. Handling Events and Callbacks
Listening to page events
Capturing alert messages
Answering prompt messages
Responding to confirm pop ups - OK or Cancel
Performing user events
Chapter 4. Capturing Errors
Handling PhantomJS errors
Capturing page script errors
Anticipating the page loading error
Exiting with error codes
Chapter 5. Grabbing Pages
Undocumented supported image format
Screenshot dimensions
Saving web pages as PDFs
Chapter 6. Accessing Location-based Services
Checking a location based on IP address
Getting driving directions
Looking up for pizza delivery establishments
Chapter 7. Working with Files
PhantomJS FileSystem API
Reading files
Writing files
Character encoding
Chapter 8. Cookies
Reading cookies
Baking some cookies
Deleting cookies
Keeping cookies
Chapter 9. External JavaScript
Modules
Using the object-oriented modules
Using third-party JavaScript libraries
Chapter 10. Testing with PhantomJS
What is unit testing?
Unit testing with Jasmine
Chapter 11. Maximizing PhantomJS
CasperJS
GhostDriver
Screenshots web metrics and more
Index