11'use strict' ;
22
33const path = require ( 'path' ) ;
4- const bluebirdQ = require ( 'bluebird-q' ) ;
54const browserify = require ( 'browserify' ) ;
65const debug = require ( 'debug' ) ;
76const chalk = require ( 'chalk' ) ;
@@ -74,11 +73,11 @@ module.exports = class NewBrowser extends Browser {
7473 }
7574
7675 _applyWdMethodInContext ( method , context , args ) {
77- return bluebirdQ ( this . _wd . currentContext ( ) )
76+ return this . _wd . currentContext ( )
7877 . then ( ( originalContext ) => {
79- return bluebirdQ ( this . _wd . context ( context ) )
78+ return this . _wd . context ( context )
8079 . then ( ( ) => this . _applyWdMethod ( method , args ) )
81- . finally ( ( ) => bluebirdQ ( this . _wd . context ( originalContext ) ) ) ;
80+ . finally ( ( ) => this . _wd . context ( originalContext ) ) ;
8281 } ) ;
8382 }
8483
@@ -153,7 +152,7 @@ module.exports = class NewBrowser extends Browser {
153152
154153 initSession ( ) {
155154 return this . _setSessionTimeout ( this . config . sessionRequestTimeout )
156- . then ( ( ) => bluebirdQ ( this . _wd . init ( this . capabilities ) ) )
155+ . then ( ( ) => this . _wd . init ( this . capabilities ) )
157156 . spread ( ( sessionId ) => {
158157 this . sessionId = sessionId ;
159158 this . log ( 'launched session %o' , this ) ;
@@ -168,7 +167,7 @@ module.exports = class NewBrowser extends Browser {
168167 return ;
169168 }
170169
171- return bluebirdQ ( this . _wd . setWindowSize ( size . width , size . height ) )
170+ return this . _wd . setWindowSize ( size . width , size . height )
172171 . catch ( ( e ) => {
173172 // Its the only reliable way to detect not supported operation
174173 // in legacy operadriver.
@@ -196,20 +195,20 @@ module.exports = class NewBrowser extends Browser {
196195 resetZoom : true
197196 } ) ;
198197
199- return bluebirdQ ( this . _wd . get ( url ) )
198+ return this . _wd . get ( url )
200199 . then ( ( url ) => {
201200 return params . resetZoom
202- ? this . _clientBridge . call ( 'resetZoom' ) . thenReturn ( url )
201+ ? this . _clientBridge . call ( 'resetZoom' ) . then ( ( ) => url )
203202 : url ;
204203 } ) ;
205204 }
206205
207206 injectScript ( script ) {
208- return bluebirdQ ( this . _wd . execute ( script ) ) ;
207+ return this . _wd . execute ( script ) ;
209208 }
210209
211210 evalScript ( script ) {
212- return bluebirdQ ( this . _wd . eval ( script ) ) ;
211+ return this . _wd . eval ( script ) ;
213212 }
214213
215214 buildScripts ( ) {
@@ -263,7 +262,7 @@ module.exports = class NewBrowser extends Browser {
263262 reset ( ) {
264263 // We can't use findElement here because it requires page with body tag
265264 return this . evalScript ( 'document.body' )
266- . then ( body => bluebirdQ ( this . _wd . moveTo ( body , 0 , 0 ) ) )
265+ . then ( body => this . _wd . moveTo ( body , 0 , 0 ) )
267266 . catch ( e => {
268267 return Promise . reject ( _ . extend ( e || { } , {
269268 browserId : this . id ,
@@ -293,16 +292,16 @@ module.exports = class NewBrowser extends Browser {
293292 }
294293
295294 _maximize ( ) {
296- return bluebirdQ ( this . _wd . windowHandle ( ) )
297- . then ( ( handle ) => bluebirdQ ( this . _wd . maximize ( handle ) ) ) ;
295+ return this . _wd . windowHandle ( )
296+ . then ( ( handle ) => this . _wd . maximize ( handle ) ) ;
298297 }
299298
300299 findElement ( ) {
301300 throw new Error ( 'findElement is called before appropriate locator is chosen' ) ;
302301 }
303302
304303 _findElementWd ( selector ) {
305- return bluebirdQ ( this . _wd . elementByCssSelector ( selector ) )
304+ return this . _wd . elementByCssSelector ( selector )
306305 . catch ( ( error ) => {
307306 if ( error . status === WdErrors . ELEMENT_NOT_FOUND ) {
308307 error . selector = selector ;
@@ -341,7 +340,7 @@ module.exports = class NewBrowser extends Browser {
341340 }
342341
343342 return this . _setSessionTimeout ( this . config . sessionQuitTimeout )
344- . then ( ( ) => bluebirdQ ( this . _wd . quit ( ) ) )
343+ . then ( ( ) => this . _wd . quit ( ) )
345344 . then ( ( ) => this . log ( 'kill browser %o' , this ) )
346345 . then ( ( ) => this . _setHttpTimeout ( ) )
347346 . catch ( ( err ) => this . log ( err ) ) ;
0 commit comments