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
a5fdadca
...
a5fdadca6a1a58c3c82a7e3b4167e214dd1f0da2
authored
2011-10-01 08:45:38 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed #2: Some functionality has broken due to 1.3 update
1 parent
f087d04b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
casper.js
casper.js
View file @
a5fdadc
...
...
@@ -368,8 +368,8 @@
this
.
options
.
logLevel
=
"warning"
;
}
// WebPage
if
(
!
(
this
.
page
instanceof
WebP
age
))
{
if
(
this
.
options
.
page
instanceof
WebPage
)
{
if
(
!
isWebPage
(
this
.
p
age
))
{
if
(
isWebPage
(
this
.
options
.
page
)
)
{
this
.
page
=
this
.
options
.
page
;
}
else
{
this
.
page
=
createPage
(
this
);
...
...
@@ -526,7 +526,12 @@
* @return WebPage
*/
function
createPage
(
casper
)
{
var
page
=
new
WebPage
();
var
page
;
if
(
phantom
.
version
.
major
<=
1
&&
phantom
.
version
.
minor
<
3
)
{
page
=
new
WebPage
();
}
else
{
page
=
require
(
'webpage'
).
create
();
}
page
.
onConsoleMessage
=
function
(
msg
)
{
casper
.
log
(
msg
,
"info"
,
"remote"
);
};
...
...
@@ -612,4 +617,21 @@
}
return
fn
;
}
/**
* Checks if the provided var is a WebPage instance
*
* @param mixed what
* @return Boolean
*/
function
isWebPage
(
what
)
{
if
(
!
what
||
typeof
(
what
)
!==
"object"
)
{
return
false
;
}
if
(
phantom
.
version
.
major
<=
1
&&
phantom
.
version
.
minor
<
3
)
{
return
what
instanceof
WebPage
;
}
else
{
return
what
.
indexOf
(
'WebPage('
)
===
0
;
}
}
})(
phantom
);
...
...
Please
register
or
sign in
to post a comment