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
304727b9
...
304727b9818a7ec65b5b97a1cd3d3c40a55425c6
authored
2011-10-08 21:14:04 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added new 'timeout' option to Casper, I guess its name speaks for itself
1 parent
bc0ab989
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
README.md
casper.js
README.md
View file @
304727b
...
...
@@ -209,6 +209,7 @@ onDie | function | null | A function to be called when Casper#die
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
timeout | Number | null | Max timeout in milliseconds
verbose | Boolean | false | Realtime output of log messages
```
...
...
casper.js
View file @
304727b
...
...
@@ -35,6 +35,7 @@
* 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
* timeout | Number | null | Max timeout in milliseconds
* verbose | Boolean | false | Realtime output of log messages
*
* @param Object options Casper options
...
...
@@ -56,6 +57,7 @@
onPageInitialized
:
null
,
page
:
null
,
pageSettings
:
{
userAgent
:
DEFAULT_USER_AGENT
},
timeout
:
null
,
verbose
:
false
};
// local properties
...
...
@@ -418,6 +420,12 @@
}
this
.
page
.
settings
=
mergeObjects
(
this
.
page
.
settings
,
this
.
options
.
pageSettings
);
this
.
started
=
true
;
if
(
typeof
(
this
.
options
.
timeout
)
===
"number"
&&
this
.
options
.
timeout
>
0
)
{
self
.
log
(
"execution timeout set to "
+
this
.
options
.
timeout
+
'ms'
,
"info"
);
setTimeout
(
function
(
self
)
{
self
.
log
(
"timeout of "
+
self
.
options
.
timeout
+
"ms exceeded"
,
"info"
).
exit
();
},
this
.
options
.
timeout
,
this
);
}
if
(
typeof
(
this
.
options
.
onPageInitialized
)
===
"function"
)
{
this
.
log
(
"Post-configuring WebPage instance"
,
"debug"
);
this
.
options
.
onPageInitialized
(
this
.
page
);
...
...
Please
register
or
sign in
to post a comment