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
063ddf76
...
063ddf76b6d057cad22ad094dd9a281626deb32f
authored
2011-12-25 21:35:48 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed erroneous error handling in Casper.capture()
1 parent
427c643f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
4 deletions
lib/casper.js
samples/screenshot.js
lib/casper.js
View file @
063ddf7
...
...
@@ -143,6 +143,7 @@
*/
capture
:
function
(
targetFile
,
clipRect
)
{
var
previousClipRect
;
targetFile
=
require
(
'fs'
).
absolute
(
targetFile
);
if
(
clipRect
)
{
if
(
!
isType
(
clipRect
,
"object"
))
{
throw
new
Error
(
"clipRect must be an Object instance."
);
...
...
@@ -153,10 +154,8 @@
}
else
{
this
.
log
(
'Capturing page to '
+
targetFile
,
"debug"
);
}
try
{
this
.
page
.
render
(
targetFile
);
}
catch
(
e
)
{
this
.
log
(
'Failed to capture screenshot as '
+
targetFile
+
': '
+
e
,
"error"
);
if
(
!
this
.
page
.
render
(
targetFile
))
{
this
.
log
(
'Failed to save screenshot to '
+
targetFile
+
'; please check permissions'
,
"error"
);
}
if
(
previousClipRect
)
{
this
.
page
.
clipRect
=
previousClipRect
;
...
...
samples/screenshot.js
View file @
063ddf7
Please
register
or
sign in
to post a comment