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
5f759b5f
...
5f759b5ff39f1718ad2dcccb9da31f87d877f4e2
authored
2012-05-09 08:31:59 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
googlepagination.coffee: use 'this' where applicable
1 parent
dfa2c402
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
samples/googlepagination.coffee
samples/googlepagination.coffee
View file @
5f759b5
...
...
@@ -12,22 +12,22 @@ if casper.cli.args.length == 0
casper
.
exit
()
processPage
=
->
casper
.
echo
"capturing page
#{
currentPage
}
"
casper
.
capture
"google-results-p
#{
currentPage
}
.png"
@
echo
"capturing page
#{
currentPage
}
"
@
capture
"google-results-p
#{
currentPage
}
.png"
# don't go too far down the rabbit hole
return
if
currentPage
>=
5
if
casper
.
exists
"#pnnext"
if
@
exists
"#pnnext"
currentPage
++
casper
.
echo
"requesting next page:
#{
currentPage
}
"
#
casper.
thenClick("#pnnext").then(processPage)
@
echo
"requesting next page:
#{
currentPage
}
"
#
@
thenClick("#pnnext").then(processPage)
url
=
@
getCurrentUrl
()
casper
.
thenClick
(
"#pnnext"
).
then
->
@
thenClick
(
"#pnnext"
).
then
->
check
=
->
url
!=
@
getCurrentUrl
()
@
waitFor
check
,
processPage
else
casper
.
echo
"that's all, folks."
@
echo
"that's all, folks."
casper
.
start
'http://google.fr/'
,
->
@
fill
'form[action="/search"]'
,
q
:
casper
.
cli
.
args
.
join
(
' '
),
true
...
...
Please
register
or
sign in
to post a comment