Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
bbd5410c
...
bbd5410c38d610da6872d890e712ed4279fa4620
authored
2011-09-17 12:05:23 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added an event as a Casper option
1 parent
38c19678
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
casper.js
casper.js
View file @
bbd5410
...
...
@@ -26,12 +26,15 @@
/**
* Main Casper class. Available options are:
*
* Type Name Default Description
* - Array clientScripts ([]): A collection of script filepaths to include to every page loaded
* - String logLevel ("error") Logging level (see logLevels for available values)
* - Object pageSettings ({}): PhantomJS's WebPage settings object
* - WebPage page (null): An existing WebPage instance
* - Boolean verbose (false): Realtime output of log messages
* Name | Type | Default | Description
* ——————————————————+——————————+—————————+————————————————————————————————————————————————————————————————————
* clientScripts | Array | [] | A collection of script filepaths to include to every page loaded
* logLevel | String | "error" | Logging level (see logLevels for available values)
* onDie | function | null | A function to be called when Casper#die() is called
* onPageInitialized | function | null | A function to be called after WebPage instance has been initialized
* page | WebPage | null | An existing WebPage instance
* pageSettings | Object | {} | PhantomJS's WebPage settings object
* verbose | Boolean | false | Realtime output of log messages
*
* @param Object options Casper options
* @return Casper
...
...
@@ -45,14 +48,13 @@
}
// default options
this
.
defaults
=
{
clientScripts
:
[],
logLevel
:
"error"
,
onDie
:
null
,
page
:
null
,
pageSettings
:
{
userAgent
:
DEFAULT_USER_AGENT
,
},
verbose
:
false
clientScripts
:
[],
logLevel
:
"error"
,
onDie
:
null
,
onPageInitialized
:
null
,
page
:
null
,
pageSettings
:
{
userAgent
:
DEFAULT_USER_AGENT
},
verbose
:
false
};
// local properties
this
.
checker
=
null
;
...
...
@@ -398,6 +400,10 @@
}
this
.
page
.
settings
=
mergeObjects
(
this
.
page
.
settings
,
this
.
options
.
pageSettings
);
this
.
started
=
true
;
if
(
typeof
(
this
.
options
.
onPageInitialized
)
===
"function"
)
{
this
.
log
(
"Post-configuring WebPage instance"
,
"debug"
);
this
.
options
.
onPageInitialized
(
this
.
page
);
}
if
(
typeof
(
location
)
===
"string"
&&
location
.
length
>
0
)
{
if
(
typeof
(
then
)
===
"function"
)
{
return
this
.
open
(
location
).
then
(
then
);
...
...
Please
register
or
sign in
to post a comment