@@ -140,7 +140,7 @@ export class WebPageRenderer implements IWebPageRenderer {
140140
141141 this . nightmare . on ( 'page' , ( type : string , message : string , stack : any ) => {
142142 if ( type === "error" ) {
143- this . error ( "Browser page error: " + message ) ;
143+ this . error ( "Browser page error: " + JSON . stringify ( message , null , 4 ) ) ;
144144 this . error ( stack ) ;
145145 }
146146 } ) ;
@@ -156,18 +156,17 @@ export class WebPageRenderer implements IWebPageRenderer {
156156 this . nightmare . on ( 'console' , ( type : string , message : string ) => {
157157
158158 if ( type === 'log' ) {
159- this . info ( 'LOG: ' + message ) ;
159+ this . info ( 'LOG: ' + JSON . stringify ( message , null , 4 ) ) ;
160160 return ;
161161 }
162162
163163 if ( type === 'warn' ) {
164- this . warn ( 'LOG: ' + message ) ;
164+ this . warn ( 'LOG: ' + JSON . stringify ( message , null , 4 ) ) ;
165165 return ;
166166 }
167167
168168 if ( type === 'error' ) {
169- this . error ( "Browser JavaScript error:" ) ;
170- this . error ( message ) ;
169+ this . error ( "Browser JavaScript error: " + JSON . stringify ( message , null , 4 ) ) ;
171170 }
172171 } ) ;
173172 }
@@ -237,7 +236,7 @@ export class WebPageRenderer implements IWebPageRenderer {
237236 async renderPDF ( webPageUrl : string , outputFilePath : string , options : IRenderOptions ) : Promise < void > {
238237 this . preRenderCheck ( options ) ;
239238 this . nightmare . goto ( webPageUrl ) ;
240- this . nightmare . wait ( options . waitSelector )
239+ this . nightmare . wait ( options . waitSelector ) ;
241240 await this . nightmare . evaluate ( ( ) => {
242241 const body = document . querySelector ( "body" ) ;
243242 return {
0 commit comments