fixed error when setting userAgent() casper being not started
Showing
1 changed file
with
4 additions
and
1 deletions
... | @@ -1586,7 +1586,10 @@ Casper.prototype.toString = function toString() { | ... | @@ -1586,7 +1586,10 @@ Casper.prototype.toString = function toString() { |
1586 | */ | 1586 | */ |
1587 | Casper.prototype.userAgent = function userAgent(agent) { | 1587 | Casper.prototype.userAgent = function userAgent(agent) { |
1588 | "use strict"; | 1588 | "use strict"; |
1589 | this.options.pageSettings.userAgent = this.page.settings.userAgent = agent; | 1589 | this.options.pageSettings.userAgent = agent; |
1590 | if (this.started && this.page) { | ||
1591 | this.page.settings.userAgent = agent; | ||
1592 | } | ||
1590 | return this; | 1593 | return this; |
1591 | }; | 1594 | }; |
1592 | 1595 | ... | ... |
-
Please register or sign in to post a comment