Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with PhantomJS

You're reading from   Getting Started with PhantomJS Harness the strength and capabilities of PhantomJS to interact with the web and perform website testing with a headless browser based on WebKit

Arrow left icon
Product type Paperback
Published in Nov 2013
Publisher Packt
ISBN-13 9781782164227
Length 140 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Aries beltran Aries beltran
Author Profile Icon Aries beltran
Aries beltran
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Getting Started 2. Manipulating Page Content FREE CHAPTER 3. Handling Events and Callbacks 4. Capturing Errors 5. Grabbing Pages 6. Accessing Location-based Services 7. Working with Files 8. Cookies 9. External JavaScript 10. Testing with PhantomJS 11. Maximizing PhantomJS Index

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. The following are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "The onLoadStarted event will be triggered when PhantomJS starts loading the page based on the resources received."

A block of code is set as follows:

var system = require('system');
var url = system.args[1];

var page = require('webpage').create();
page.onLoadStarted = function () {
  console.log('Page Loading Started');
};

page.onLoadFinished = function () {
  console.log('Page Loaded');
  phantom.exit(0);
};

page.open(url);

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

[default]
exten => s,1,Dial(Zap/1|30)
exten => s,2,Voicemail(u100)
exten => s,102,Voicemail(b100)
exten => i,1,Voicemail(s0)

Any command-line input or output is written as follows:

$ ./phantomjs pageload3.js http://www.google.com
Loading takes 6.751 seconds.
0.255 seconds : http://www.google.com/
0.379 seconds : http://www.google.com.ph/
0.213 seconds : http://ssl.gstatic.com/gb/images/b_8d5afc09.png
0.676 seconds : http://www.google.com.ph/images/srpr/logo1w.png
0.561 seconds : http://www.google.com.ph/images/srpr/nav_logo80.png
6.135 seconds : http://www.google.com.ph/xjs/_/js/hp/sb_he,pcc/rt=j/ver=_aDh7zAWqI8.en_US./d=1/sv=1/rs=AItRSTOgg467Qcx4GftzMMz3ZDPd84lcog

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes, for example, appear in the text like this: "Using a simple page open, handling these two events will give us two console prints: Page Loading Started which is displayed first, followed by Page Loaded."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime