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
37bdd108
...
37bdd108884d2859fd9df1c7549670d8fdb03b75
authored
2012-08-03 23:43:26 -0400
by
Chris Lorenzo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fix for when the url is changed via javascript
1 parent
5ed461e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletions
modules/casper.js
modules/casper.js
View file @
37bdd10
...
...
@@ -117,6 +117,7 @@ var Casper = function Casper(options) {
this
.
defaultWaitTimeout
=
5000
;
this
.
history
=
[];
this
.
loadInProgress
=
false
;
this
.
navigationRequested
=
false
;
this
.
logFormats
=
{};
this
.
logLevels
=
[
"debug"
,
"info"
,
"warning"
,
"error"
];
this
.
logStyles
=
{
...
...
@@ -316,7 +317,7 @@ Casper.prototype.captureSelector = function captureSelector(targetFile, selector
*/
Casper
.
prototype
.
checkStep
=
function
checkStep
(
self
,
onComplete
)
{
"use strict"
;
if
(
self
.
pendingWait
||
self
.
loadInProgress
)
{
if
(
self
.
pendingWait
||
self
.
loadInProgress
||
self
.
navigationRequested
)
{
return
;
}
var
step
=
self
.
steps
[
self
.
step
++
];
...
...
@@ -1667,6 +1668,9 @@ function createPage(casper) {
page
.
onNavigationRequested
=
function
onNavigationRequested
(
url
,
navigationType
,
navigationLocked
,
isMainFrame
)
{
casper
.
log
(
f
(
'Navigation requested: url=%s, type=%s, lock=%s, isMainFrame=%s'
,
url
,
navigationType
,
navigationLocked
,
isMainFrame
),
"debug"
);
if
(
isMainFrame
)
{
casper
.
navigationRequested
=
true
;
}
casper
.
emit
(
'navigation.requested'
,
url
,
navigationType
,
navigationLocked
,
isMainFrame
);
};
page
.
onPrompt
=
function
onPrompt
(
message
,
value
)
{
...
...
@@ -1701,6 +1705,7 @@ function createPage(casper) {
};
page
.
onUrlChanged
=
function
onUrlChanged
(
url
)
{
casper
.
log
(
f
(
'url changed to "%s"'
,
url
),
"debug"
);
casper
.
navigationRequested
=
false
;
casper
.
emit
(
'url.changed'
,
url
);
};
casper
.
emit
(
'page.created'
,
page
);
...
...
Please
register
or
sign in
to post a comment