File tree Expand file tree Collapse file tree 1 file changed +19
-11
lines changed Expand file tree Collapse file tree 1 file changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -191,17 +191,25 @@ class ResembleHelper extends Helper {
191191 async _getBoundingBox ( selector ) {
192192 const browser = this . _getBrowser ( ) ;
193193
194- var ele = await browser . element ( selector )
195- . then ( ( res ) => {
196- return res ;
197- } )
198- . catch ( ( err ) => {
199- // Catch the error because webdriver.io throws if the element could not be found
200- // Source: https://github.com/webdriverio/webdriverio/blob/master/lib/protocol/element.js
201- return null ;
202- } ) ;
203- var location = await browser . getLocation ( selector ) ;
204- var size = await browser . getElementSize ( selector ) ;
194+ if ( this . helpers [ 'WebDriver' ] ) {
195+ const ele = await browser . $ ( selector ) ;
196+ var location = await ele . getLocation ( ) ;
197+ var size = await ele . getSize ( ) ;
198+ }
199+ else {
200+ var ele = await browser . element ( selector )
201+ . then ( ( res ) => {
202+ return res ;
203+ } )
204+ . catch ( ( err ) => {
205+ // Catch the error because webdriver.io throws if the element could not be found
206+ // Source: https://github.com/webdriverio/webdriverio/blob/master/lib/protocol/element.js
207+ return null ;
208+ } ) ;
209+ var location = await browser . getLocation ( selector ) ;
210+ var size = await browser . getElementSize ( selector ) ;
211+ }
212+
205213 var bottom = size . height + location . y ;
206214 var right = size . width + location . x ;
207215 var boundingBox = {
You can’t perform that action at this time.
0 commit comments