added supplementary check for phantomjs version
Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -579,7 +579,7 @@ | ... | @@ -579,7 +579,7 @@ |
579 | */ | 579 | */ |
580 | function createPage(casper) { | 580 | function createPage(casper) { |
581 | var page; | 581 | var page; |
582 | if (phantom.version.major <= 1 && phantom.version.minor < 3) { | 582 | if (phantom.version.major <= 1 && phantom.version.minor < 3 && typeof(require) === "function") { |
583 | page = new WebPage(); | 583 | page = new WebPage(); |
584 | } else { | 584 | } else { |
585 | page = require('webpage').create(); | 585 | page = require('webpage').create(); |
... | @@ -642,7 +642,7 @@ | ... | @@ -642,7 +642,7 @@ |
642 | if (!what || typeof(what) !== "object") { | 642 | if (!what || typeof(what) !== "object") { |
643 | return false; | 643 | return false; |
644 | } | 644 | } |
645 | if (phantom.version.major <= 1 && phantom.version.minor < 3) { | 645 | if (phantom.version.major <= 1 && phantom.version.minor < 3 && typeof(require) === "function") { |
646 | return what instanceof WebPage; | 646 | return what instanceof WebPage; |
647 | } else { | 647 | } else { |
648 | return what.toString().indexOf('WebPage(') === 0; | 648 | return what.toString().indexOf('WebPage(') === 0; | ... | ... |
-
Please register or sign in to post a comment