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
3ffc42fa
...
3ffc42fa87dfb9fc14ebd24675b0a1e474cf7f76
authored
2012-01-15 08:06:27 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
fixed CS CS standards & typos in samples
2 parents
cd2a1a77
49594d97
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
17 deletions
.travis.yml
samples/download.coffee
samples/each.js
samples/events.coffee
samples/events.js
samples/screenshot.coffee
samples/screenshot.js
.travis.yml
View file @
3ffc42f
...
...
@@ -2,7 +2,7 @@ branches:
only
:
-
master
before_script
:
-
"
export
PHANTOMJS_EXECUTABLE='phantomjs'"
-
"
export
PHANTOMJS_EXECUTABLE='phantomjs
--local-to-remote-url-access=yes
--ignore-ssl-errors=yes
'"
-
"
export
DISPLAY=:99.0"
-
"
sh
-e
/etc/init.d/xvfb
start"
script
:
...
...
samples/download.coffee
View file @
3ffc42f
#
download the google logo image as base64
#
## download the google logo image as base64 ###
casper
=
require
(
'casper'
).
create
verbose
:
true
...
...
samples/each.js
View file @
3ffc42f
...
...
@@ -12,6 +12,4 @@ casper.start().each(links, function(self, link) {
});
});
casper
.
run
(
function
(
self
)
{
self
.
exit
();
});
casper
.
run
();
...
...
samples/events.coffee
View file @
3ffc42f
casper
=
require
(
'casper'
).
create
()
casper
.
on
"http.status.200"
,
(
resource
)
->
casper
.
echo
"
#{
resource
.
url
}
is OK"
,
"INFO"
@
echo
"
#{
resource
.
url
}
is OK"
,
"INFO"
casper
.
on
"http.status.301"
,
(
resource
)
->
casper
.
echo
"
#{
resource
.
url
}
is permanently redirected"
,
"PARAMETER"
@
echo
"
#{
resource
.
url
}
is permanently redirected"
,
"PARAMETER"
casper
.
on
"http.status.302"
,
(
resource
)
->
casper
.
echo
"
#{
resource
.
url
}
is temporarily redirected"
,
"PARAMETER"
@
echo
"
#{
resource
.
url
}
is temporarily redirected"
,
"PARAMETER"
casper
.
on
"http.status.404"
,
(
resource
)
->
casper
.
echo
"
#{
resource
.
url
}
is not found"
,
"COMMENT"
@
echo
"
#{
resource
.
url
}
is not found"
,
"COMMENT"
casper
.
on
"http.status.500"
,
(
resource
)
->
casper
.
echo
"
#{
resource
.
url
}
is in error"
,
"ERROR"
@
echo
"
#{
resource
.
url
}
is in error"
,
"ERROR"
links
=
[
'http://google.com/'
...
...
samples/events.js
View file @
3ffc42f
...
...
@@ -5,23 +5,23 @@
var
casper
=
require
(
'casper'
).
create
();
casper
.
on
(
'http.status.200'
,
function
(
resource
)
{
casper
.
echo
(
resource
.
url
+
' is OK'
,
'INFO'
);
this
.
echo
(
resource
.
url
+
' is OK'
,
'INFO'
);
});
casper
.
on
(
'http.status.301'
,
function
(
resource
)
{
casper
.
echo
(
resource
.
url
+
' is permanently redirected'
,
'PARAMETER'
);
this
.
echo
(
resource
.
url
+
' is permanently redirected'
,
'PARAMETER'
);
});
casper
.
on
(
'http.status.302'
,
function
(
resource
)
{
casper
.
echo
(
resource
.
url
+
' is temporarily redirected'
,
'PARAMETER'
);
this
.
echo
(
resource
.
url
+
' is temporarily redirected'
,
'PARAMETER'
);
});
casper
.
on
(
'http.status.404'
,
function
(
resource
)
{
casper
.
echo
(
resource
.
url
+
' is not found'
,
'COMMENT'
);
this
.
echo
(
resource
.
url
+
' is not found'
,
'COMMENT'
);
});
casper
.
on
(
'http.status.500'
,
function
(
resource
)
{
casper
.
echo
(
resource
.
url
+
' is in error'
,
'ERROR'
);
this
.
echo
(
resource
.
url
+
' is in error'
,
'ERROR'
);
});
var
links
=
[
...
...
samples/screenshot.coffee
View file @
3ffc42f
### This script will capture a screenshot of a twitter account page
Usage $ casperjs screenshot.coffee <twitter-account>
Usage $ casperjs screenshot.coffee <twitter-account>
<filename.[jpg|png|pdf]>
###
casper
=
require
(
'casper'
).
create
viewportSize
:
...
...
samples/screenshot.js
View file @
3ffc42f
/**
* This script will capture a screenshot of a twitter account page
*
* Usage $ casperjs screenshot.coffee <twitter-account>
* Usage $ casperjs screenshot.coffee <twitter-account>
<filename.[jpg|png|pdf]>
*/
var
casper
=
require
(
'casper'
).
create
({
viewportSize
:
{
...
...
Please
register
or
sign in
to post a comment