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
f087d04b
...
f087d04b06113e559dffbd018123ae3f5b39a283
authored
2011-09-30 18:15:28 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added Casper#captureSelector() to capture and render a DOM element by its CSS3 selector
1 parent
64e3fd68
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
casper.js
casper.js
View file @
f087d04
...
...
@@ -117,6 +117,23 @@
},
/**
* Captures the page area containing the provided selector.
*
* @param String targetFile Target destination file path.
* @param String selector CSS3 selector
* @return Casper
*/
captureSelector
:
function
(
targetFile
,
selector
)
{
return
this
.
capture
(
targetFile
,
self
.
evaluate
(
function
()
{
try
{
return
document
.
querySelector
(
selector
).
getBoundingClientRect
();
}
catch
(
e
)
{
console
.
log
(
'unable to fetch bounds for element '
+
selector
);
}
}));
},
/**
* Checks for any further navigation step to process.
*
* @param Casper self A self reference
...
...
@@ -338,6 +355,9 @@
* @return Casper
*/
start
:
function
(
location
,
then
)
{
if
(
this
.
started
)
{
this
.
log
(
"start failed: Casper has already started!"
,
"error"
);
}
this
.
log
(
'Starting…'
,
"info"
);
this
.
startTime
=
new
Date
().
getTime
();
this
.
steps
=
[];
...
...
Please
register
or
sign in
to post a comment