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
963d1a3b
...
963d1a3b10cd5cf10f467bbdc98bdaf9ba7e4eb6
authored
2011-12-18 14:56:07 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added casper.cli proxy property for phantom.casperArgs; updated samples
1 parent
cbb88484
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
10 deletions
lib/casper.js
samples/extends.js
samples/googlematch.js
samples/googlepagination.coffee
samples/steptimeout.js
tests/run.js
lib/casper.js
View file @
963d1a3
...
...
@@ -64,9 +64,9 @@
timeout
:
null
,
verbose
:
false
};
// privates
// local properties
// properties
this
.
checker
=
null
;
this
.
cli
=
phantom
.
casperArgs
;
this
.
colorizer
=
new
phantom
.
Casper
.
Colorizer
();
this
.
currentUrl
=
'about:blank'
;
this
.
currentHTTPStatus
=
200
;
...
...
samples/extends.js
View file @
963d1a3
...
...
@@ -42,7 +42,7 @@ var casper = new phantom.Casper({
loadImages
:
false
,
loadPlugins
:
false
,
logLevel
:
"debug"
,
verbose
:
true
,
verbose
:
true
});
casper
.
start
()
...
...
samples/googlematch.js
View file @
963d1a3
...
...
@@ -26,7 +26,7 @@ phantom.Casper.extend({
var
casper
=
new
phantom
.
Casper
({
verbose
:
true
}),
terms
=
phantom
.
casperArgs
.
args
,
scores
=
[],
i
=
0
;
}),
terms
=
casper
.
cli
.
args
,
scores
=
[],
i
=
0
;
if
(
terms
.
length
<
2
)
{
casper
.
echo
(
'Usage: casperjs googlematch.js term1, term2 [, term3]...'
).
exit
();
...
...
@@ -54,7 +54,7 @@ casper.run(function(self) {
return
a
.
score
-
b
.
score
;
});
var
winner
=
scores
[
scores
.
length
-
1
];
self
.
echo
(
'winner is "'
+
winner
.
term
+
'" with '
+
winner
.
score
+
' results'
)
self
.
echo
(
'winner is "'
+
winner
.
term
+
'" with '
+
winner
.
score
+
' results'
)
;
self
.
exit
();
});
...
...
samples/googlepagination.coffee
View file @
963d1a3
...
...
@@ -12,7 +12,7 @@ links = []
casper
=
new
phantom
.
Casper
casper
.
start
'http://google.com'
,
->
@
fill
'form[name=f]'
,
q
:
phantom
.
args
.
join
(
' '
),
true
@
fill
'form[name=f]'
,
q
:
casper
.
cli
.
args
.
join
(
' '
),
true
@
click
'input[value="Google Search"]'
casper
.
then
->
...
...
samples/steptimeout.js
View file @
963d1a3
...
...
@@ -29,7 +29,7 @@ var links = [
'http://cdiscount.fr/'
];
casper
.
echo
(
'Testing with timeout='
+
timeout
);
casper
.
echo
(
'Testing with timeout='
+
timeout
+
'ms.'
);
casper
.
start
();
...
...
tests/run.js
View file @
963d1a3
...
...
@@ -25,9 +25,13 @@ phantom.Casper.extend({
(
function
(
casper
)
{
var
tests
=
[];
if
(
phantom
.
casperArgs
.
args
.
length
>
2
&&
fs
.
isFile
(
phantom
.
casperArgs
.
args
[
2
]))
{
tests
=
[
phantom
.
casperArgs
.
args
[
2
]];
}
else
{
if
(
casper
.
cli
.
args
.
length
)
{
tests
=
casper
.
cli
.
args
.
filter
(
function
(
path
)
{
return
fs
.
isFile
(
path
)
||
fs
.
isDirectory
(
path
);
});
}
if
(
!
tests
.
length
)
{
// default test suite is casperjs' one
tests
=
[
fs
.
absolute
(
fs
.
pathJoin
(
phantom
.
casperPath
,
'tests'
,
'suites'
))];
}
casper
.
test
.
runSuites
.
apply
(
casper
.
test
,
tests
);
...
...
Please
register
or
sign in
to post a comment