File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ export class Browser {
2222 validateOptions ( options ) {
2323 options . width = parseInt ( options . width ) || 1000 ;
2424 options . height = parseInt ( options . height ) || 500 ;
25+ options . timeout = parseInt ( options . timeout ) || 30 ;
2526
2627 if ( options . width > 3000 || options . width < 10 ) {
2728 options . width = 2500 ;
@@ -51,6 +52,14 @@ export class Browser {
5152
5253 await page . goto ( options . url ) ;
5354
55+ // wait for all panels to render
56+ await page . waitForFunction ( ( ) => {
57+ var panelCount = document . querySelectorAll ( '.panel' ) . length ;
58+ return ( < any > window ) . panelsRendered >= panelCount ;
59+ } , {
60+ timeout : options . timeout * 1000
61+ } ) ;
62+
5463 if ( ! options . filePath ) {
5564 options . filePath = uniqueFilename ( os . tmpdir ( ) ) + '.png' ;
5665 }
You can’t perform that action at this time.
0 commit comments