File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -75,17 +75,21 @@ class ResembleHelper extends Helper {
7575 * @returns {Promise<void }
7676 */
7777 async screenshotElement ( selector , name ) {
78- const helper = this . _getHelper ( ) ;
79- const configuration = this . config ;
78+
79+ if ( this . helpers [ 'Puppeteer' ] ) {
80+ const helper = this . _getHelper ( ) ;
81+ const configuration = this . config ;
8082
81- await helper . waitForVisible ( selector ) ;
82- const els = await helper . _locate ( selector ) ;
83- if ( ! els . length ) throw new Error ( `Element ${ selector } couldn't be located` ) ;
84- const el = els [ 0 ] ;
83+ await helper . waitForVisible ( selector ) ;
84+ const els = await helper . _locate ( selector ) ;
85+ if ( ! els . length ) throw new Error ( `Element ${ selector } couldn't be located` ) ;
86+ const el = els [ 0 ] ;
8587
86- await el . screenshot ( {
87- path : configuration . screenshotFolder + name + '.png'
88- } ) ;
88+ await el . screenshot ( {
89+ path : configuration . screenshotFolder + name + '.png'
90+ } ) ;
91+ }
92+ else throw new Error ( "Method to be called only with Puppeteer. Other helpers not supported" ) ;
8993 }
9094
9195 /**
You can’t perform that action at this time.
0 commit comments