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
3b464914
...
3b4649144ef6746386652c93b260329e3d6c9072
authored
2012-10-19 14:06:19 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixes #220, #237 - added a waitTimeout options
1 parent
054b1375
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
CHANGELOG.md
modules/casper.js
CHANGELOG.md
View file @
3b46491
...
...
@@ -8,6 +8,7 @@ This version is yet to be released.
### Important Changes & Caveats
**BC BREAK**
: - fixes
[
#220
](
https://github.com/n1k0/casperjs/issues/220
)
,
[
#237
](
https://github.com/n1k0/casperjs/issues/237
)
- added a
`waitTimeout`
options, removed
`defaultWaitTimeout`
option.
**BC BREAK**
(for the better): merged
[
#188
](
https://github.com/n1k0/casperjs/issues/188
)
- Easy access to current response object;
You can now access the current response object as the first parameter of step callbacks:
...
...
modules/casper.js
View file @
3b46491
...
...
@@ -103,7 +103,8 @@ var Casper = function Casper(options) {
},
stepTimeout
:
null
,
timeout
:
null
,
verbose
:
false
verbose
:
false
,
waitTimeout
:
5000
};
// options
this
.
options
=
utils
.
mergeObjects
(
this
.
defaults
,
options
);
...
...
@@ -114,7 +115,6 @@ var Casper = function Casper(options) {
this
.
currentResponse
=
undefined
;
this
.
currentUrl
=
'about:blank'
;
this
.
currentHTTPStatus
=
null
;
this
.
defaultWaitTimeout
=
5000
;
this
.
history
=
[];
this
.
loadInProgress
=
false
;
this
.
navigationRequested
=
false
;
...
...
@@ -1244,7 +1244,7 @@ Casper.prototype.start = function start(location, then) {
* @return Object
*/
Casper
.
prototype
.
status
=
function
status
(
asString
)
{
var
properties
=
[
'currentHTTPStatus'
,
'
defaultWaitTimeout'
,
'
loadInProgress'
,
'navigationRequested'
,
var
properties
=
[
'currentHTTPStatus'
,
'loadInProgress'
,
'navigationRequested'
,
'options'
,
'pendingWait'
,
'requestUrl'
,
'started'
,
'step'
,
'url'
];
var
currentStatus
=
{};
properties
.
forEach
(
function
(
property
)
{
...
...
@@ -1491,7 +1491,7 @@ Casper.prototype.waitDone = function waitDone() {
*/
Casper
.
prototype
.
waitFor
=
function
waitFor
(
testFx
,
then
,
onTimeout
,
timeout
)
{
"use strict"
;
timeout
=
timeout
?
timeout
:
this
.
defaultW
aitTimeout
;
timeout
=
timeout
?
timeout
:
this
.
options
.
w
aitTimeout
;
if
(
!
utils
.
isFunction
(
testFx
))
{
this
.
die
(
"waitFor() needs a test function"
);
}
...
...
@@ -1539,7 +1539,7 @@ Casper.prototype.waitFor = function waitFor(testFx, then, onTimeout, timeout) {
*/
Casper
.
prototype
.
waitForResource
=
function
waitForResource
(
test
,
then
,
onTimeout
,
timeout
)
{
"use strict"
;
timeout
=
timeout
?
timeout
:
this
.
defaultW
aitTimeout
;
timeout
=
timeout
?
timeout
:
this
.
options
.
w
aitTimeout
;
return
this
.
waitFor
(
function
_check
()
{
return
this
.
resourceExists
(
test
);
},
then
,
onTimeout
,
timeout
);
...
...
@@ -1557,7 +1557,7 @@ Casper.prototype.waitForResource = function waitForResource(test, then, onTimeou
*/
Casper
.
prototype
.
waitForSelector
=
function
waitForSelector
(
selector
,
then
,
onTimeout
,
timeout
)
{
"use strict"
;
timeout
=
timeout
?
timeout
:
this
.
defaultW
aitTimeout
;
timeout
=
timeout
?
timeout
:
this
.
options
.
w
aitTimeout
;
return
this
.
waitFor
(
function
_check
()
{
return
this
.
exists
(
selector
);
},
then
,
onTimeout
,
timeout
);
...
...
@@ -1575,7 +1575,7 @@ Casper.prototype.waitForSelector = function waitForSelector(selector, then, onTi
*/
Casper
.
prototype
.
waitWhileSelector
=
function
waitWhileSelector
(
selector
,
then
,
onTimeout
,
timeout
)
{
"use strict"
;
timeout
=
timeout
?
timeout
:
this
.
defaultW
aitTimeout
;
timeout
=
timeout
?
timeout
:
this
.
options
.
w
aitTimeout
;
return
this
.
waitFor
(
function
_check
()
{
return
!
this
.
exists
(
selector
);
},
then
,
onTimeout
,
timeout
);
...
...
@@ -1593,7 +1593,7 @@ Casper.prototype.waitWhileSelector = function waitWhileSelector(selector, then,
*/
Casper
.
prototype
.
waitUntilVisible
=
function
waitUntilVisible
(
selector
,
then
,
onTimeout
,
timeout
)
{
"use strict"
;
timeout
=
timeout
?
timeout
:
this
.
defaultW
aitTimeout
;
timeout
=
timeout
?
timeout
:
this
.
options
.
w
aitTimeout
;
return
this
.
waitFor
(
function
_check
()
{
return
this
.
visible
(
selector
);
},
then
,
onTimeout
,
timeout
);
...
...
@@ -1611,7 +1611,7 @@ Casper.prototype.waitUntilVisible = function waitUntilVisible(selector, then, on
*/
Casper
.
prototype
.
waitWhileVisible
=
function
waitWhileVisible
(
selector
,
then
,
onTimeout
,
timeout
)
{
"use strict"
;
timeout
=
timeout
?
timeout
:
this
.
defaultW
aitTimeout
;
timeout
=
timeout
?
timeout
:
this
.
options
.
w
aitTimeout
;
return
this
.
waitFor
(
function
_check
()
{
return
!
this
.
visible
(
selector
);
},
then
,
onTimeout
,
timeout
);
...
...
Please
register
or
sign in
to post a comment