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
0c56753a
...
0c56753a3e71c1e2b5b30d655a88eac1b7cab1b2
authored
2011-11-06 11:04:53 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Caster.waitFor 'then' parameter is now optional
1 parent
9d4432d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
casper.js
casper.js
View file @
0c56753
...
...
@@ -636,9 +636,10 @@
/**
* Waits until a function returns true to process a next step.
*
* @param Function testFx A function to be evaluated for returning condition satisfecit
* @param Function then The next step to perform
* @param Number timeout The max amount of time to wait, in milliseconds
* @param Function testFx A function to be evaluated for returning condition satisfecit
* @param Function then The next step to perform (optional)
* @param Function onTimeout A callback function to call on timeout (optional)
* @param Number timeout The max amount of time to wait, in milliseconds (optional)
* @return Casper
*/
waitFor
:
function
(
testFx
,
then
,
onTimeout
,
timeout
)
{
...
...
@@ -646,8 +647,8 @@
if
(
typeof
testFx
!==
"function"
)
{
this
.
die
(
"waitUntil() needs a test function"
);
}
if
(
typeof
then
!==
"function"
)
{
this
.
die
(
"waitUntil() ne
eds a next step defini
tion"
);
if
(
t
hen
&&
t
ypeof
then
!==
"function"
)
{
this
.
die
(
"waitUntil() ne
xt step definition must be a func
tion"
);
}
this
.
delayedExecution
=
true
;
var
start
=
new
Date
().
getTime
();
...
...
@@ -667,7 +668,9 @@
clearInterval
(
interval
);
}
else
{
self
.
log
(
"waitFor() finished in "
+
(
new
Date
().
getTime
()
-
start
)
+
"ms."
,
"info"
);
self
.
then
(
then
);
if
(
then
)
{
self
.
then
(
then
);
}
clearInterval
(
interval
);
}
}
...
...
@@ -680,8 +683,9 @@
* remote DOM to process a next step.
*
* @param String selector A CSS3 selector
* @param Function then The next step to perform
* @param Number timeout The max amount of time to wait, in milliseconds
* @param Function then The next step to perform (optional)
* @param Function onTimeout A callback function to call on timeout (optional)
* @param Number timeout The max amount of time to wait, in milliseconds (optional)
* @return Casper
*/
waitForSelector
:
function
(
selector
,
then
,
onTimeout
,
timeout
)
{
...
...
@@ -715,7 +719,7 @@
* @return Boolean
*/
this
.
click
=
function
(
selector
)
{
var
elem
=
document
.
querySelector
(
selector
);
var
elem
=
this
.
findOne
(
selector
);
if
(
!
elem
)
{
return
false
;
}
...
...
Please
register
or
sign in
to post a comment