@@ -202,19 +202,21 @@ export class WebPageRenderer implements IWebPageRenderer {
202
202
. then ( ( bodySize : any ) => {
203
203
return this . nightmare . viewport ( bodySize . width , bodySize . height )
204
204
} )
205
- this . nightmare . evaluate (
206
- ( captureSelector : string ) => {
207
- const element = document . querySelector ( captureSelector ) ;
208
- const rect = element . getBoundingClientRect ( ) ;
209
- return {
210
- x : Math . ceil ( rect . left ) ,
211
- y : Math . ceil ( rect . top ) ,
212
- height : Math . ceil ( rect . bottom - rect . top ) ,
213
- width : Math . ceil ( rect . right - rect . left ) ,
214
- } ;
215
- } ,
216
- options . captureSelector || options . waitSelector ,
217
- )
205
+ . then ( ( ) => {
206
+ return this . nightmare . evaluate (
207
+ ( captureSelector : string ) => {
208
+ const element = document . querySelector ( captureSelector ) ;
209
+ const rect = element . getBoundingClientRect ( ) ;
210
+ return {
211
+ x : Math . ceil ( rect . left ) ,
212
+ y : Math . ceil ( rect . top ) ,
213
+ height : Math . ceil ( rect . bottom - rect . top ) ,
214
+ width : Math . ceil ( rect . right - rect . left ) ,
215
+ } ;
216
+ } ,
217
+ options . captureSelector || options . waitSelector ,
218
+ )
219
+ } )
218
220
. then ( ( rect : any ) => {
219
221
return this . nightmare . screenshot ( outputFilePath , rect ) ;
220
222
} ) ;
0 commit comments