@@ -8,7 +8,7 @@ var webdriver = require("selenium-webdriver"),
8
8
exports . get = function ( driver ) {
9
9
return function ( url ) {
10
10
return function ( cb , eb ) {
11
- driver . get ( url ) . then ( cb ) . thenCatch ( eb ) ;
11
+ driver . get ( url ) . then ( cb , eb ) ;
12
12
} ;
13
13
} ;
14
14
} ;
@@ -39,17 +39,16 @@ exports.wait = function(check) {
39
39
} else {
40
40
eb ( new Error ( "wait promise has returned false" ) ) ;
41
41
}
42
- } ) . thenCatch ( eb ) ;
43
- } )
44
- . thenCatch ( eb ) ;
42
+ } , eb ) ;
43
+ } , eb ) ;
45
44
} ;
46
45
} ;
47
46
} ;
48
47
} ;
49
48
50
49
exports . quit = function ( driver ) {
51
50
return function ( cb , eb ) {
52
- driver . quit ( ) . then ( cb ) . thenCatch ( eb ) ;
51
+ driver . quit ( ) . then ( cb , eb ) ;
53
52
} ;
54
53
} ;
55
54
@@ -115,7 +114,7 @@ function _find(nothing) {
115
114
return function ( cb ) {
116
115
driver . findElement ( by ) . then ( function ( el ) {
117
116
return cb ( just ( el ) ) ;
118
- } ) . thenCatch ( function ( ) {
117
+ } , function ( ) {
119
118
return cb ( nothing ) ;
120
119
} ) ;
121
120
} ;
@@ -127,7 +126,7 @@ function _find(nothing) {
127
126
function _exact ( driver ) {
128
127
return function ( by ) {
129
128
return function ( cb , eb ) {
130
- driver . findElement ( by ) . then ( cb ) . thenCatch ( eb ) ;
129
+ driver . findElement ( by ) . then ( cb , eb ) ;
131
130
} ;
132
131
} ;
133
132
}
@@ -148,9 +147,7 @@ function _finds(parent) {
148
147
return function ( cb , eb ) {
149
148
return parent . findElements ( by ) . then ( function ( children ) {
150
149
return cb ( children ) ;
151
- } ) . thenCatch ( function ( err ) {
152
- return eb ( err ) ;
153
- } ) ;
150
+ } , eb )
154
151
} ;
155
152
} ;
156
153
}
@@ -161,15 +158,15 @@ exports._findChildren = _finds;
161
158
exports . sendKeysEl = function ( keys ) {
162
159
return function ( el ) {
163
160
return function ( cb , eb ) {
164
- el . sendKeys ( keys ) . then ( cb ) . thenCatch ( eb ) ;
161
+ el . sendKeys ( keys ) . then ( cb , eb ) ;
165
162
} ;
166
163
} ;
167
164
} ;
168
165
169
166
exports . getCssValue = function ( el ) {
170
167
return function ( str ) {
171
168
return function ( cb , eb ) {
172
- return el . getCssValue ( str ) . then ( cb ) . thenCatch ( eb ) ;
169
+ return el . getCssValue ( str ) . then ( cb , eb ) ;
173
170
} ;
174
171
} ;
175
172
} ;
@@ -185,7 +182,7 @@ exports._getAttribute = function(nothing) {
185
182
} else {
186
183
cb ( just ( attr ) ) ;
187
184
}
188
- } ) . thenCatch ( eb ) ;
185
+ } , eb ) ;
189
186
} ;
190
187
} ;
191
188
} ;
@@ -194,91 +191,91 @@ exports._getAttribute = function(nothing) {
194
191
195
192
exports . getText = function ( el ) {
196
193
return function ( cb , eb ) {
197
- return el . getText ( ) . then ( cb ) . thenCatch ( eb ) ;
194
+ return el . getText ( ) . then ( cb , eb ) ;
198
195
} ;
199
196
} ;
200
197
201
198
exports . isDisplayed = function ( el ) {
202
199
return function ( cb , eb ) {
203
200
return el . isDisplayed ( ) . then ( function ( is ) {
204
201
return cb ( is ) ;
205
- } ) . thenCatch ( eb ) ;
202
+ } , eb ) ;
206
203
} ;
207
204
} ;
208
205
209
206
exports . isEnabled = function ( el ) {
210
207
return function ( cb , eb ) {
211
208
return el . isEnabled ( ) . then ( function ( is ) {
212
209
return cb ( is ) ;
213
- } ) . thenCatch ( eb ) ;
210
+ } , eb ) ;
214
211
} ;
215
212
} ;
216
213
217
214
exports . getCurrentUrl = function ( driver ) {
218
215
return function ( cb , eb ) {
219
- return driver . getCurrentUrl ( ) . then ( cb ) . thenCatch ( eb ) ;
216
+ return driver . getCurrentUrl ( ) . then ( cb , eb ) ;
220
217
} ;
221
218
} ;
222
219
223
220
exports . getTitle = function ( driver ) {
224
221
return function ( cb , eb ) {
225
- return driver . getTitle ( ) . then ( cb ) . thenCatch ( eb ) ;
222
+ return driver . getTitle ( ) . then ( cb , eb ) ;
226
223
} ;
227
224
} ;
228
225
229
226
exports . navigateBack = function ( driver ) {
230
227
return function ( cb , eb ) {
231
228
var n = new webdriver . WebDriver . Navigation ( driver ) ;
232
- return n . back ( ) . then ( cb ) . thenCatch ( eb ) ;
229
+ return n . back ( ) . then ( cb , eb ) ;
233
230
} ;
234
231
} ;
235
232
236
233
exports . navigateForward = function ( driver ) {
237
234
return function ( cb , eb ) {
238
235
var n = new webdriver . WebDriver . Navigation ( driver ) ;
239
- return n . forward ( ) . then ( cb ) . thenCatch ( eb ) ;
236
+ return n . forward ( ) . then ( cb , eb ) ;
240
237
} ;
241
238
} ;
242
239
243
240
exports . refresh = function ( driver ) {
244
241
return function ( cb , eb ) {
245
242
var n = new webdriver . WebDriver . Navigation ( driver ) ;
246
- return n . refresh ( ) . then ( cb ) . thenCatch ( eb ) ;
243
+ return n . refresh ( ) . then ( cb , eb ) ;
247
244
} ;
248
245
} ;
249
246
250
247
exports . navigateTo = function ( url ) {
251
248
return function ( driver ) {
252
249
return function ( cb , eb ) {
253
250
var n = new webdriver . WebDriver . Navigation ( driver ) ;
254
- return n . to ( url ) . then ( cb ) . thenCatch ( eb ) ;
251
+ return n . to ( url ) . then ( cb , eb ) ;
255
252
} ;
256
253
} ;
257
254
} ;
258
255
259
256
260
257
exports . getInnerHtml = function ( el ) {
261
258
return function ( cb , eb ) {
262
- el . getInnerHtml ( ) . then ( cb ) . thenCatch ( eb ) ;
259
+ el . getInnerHtml ( ) . then ( cb , eb ) ;
263
260
} ;
264
261
} ;
265
262
266
263
exports . getSize = function ( el ) {
267
264
return function ( cb , eb ) {
268
- el . getSize ( ) . then ( cb ) . thenCatch ( eb ) ;
265
+ el . getSize ( ) . then ( cb , eb ) ;
269
266
} ;
270
267
} ;
271
268
272
269
exports . getLocation = function ( el ) {
273
270
return function ( cb , eb ) {
274
- el . getLocation ( ) . then ( cb ) . thenCatch ( eb ) ;
271
+ el . getLocation ( ) . then ( cb , eb ) ;
275
272
} ;
276
273
} ;
277
274
278
275
function execute ( driver ) {
279
276
return function ( action ) {
280
277
return function ( cb , eb ) {
281
- driver . executeScript ( action ) . then ( cb ) . thenCatch ( eb ) ;
278
+ driver . executeScript ( action ) . then ( cb , eb ) ;
282
279
} ;
283
280
} ;
284
281
}
@@ -295,22 +292,21 @@ exports.affLocator = function(aff) {
295
292
296
293
exports . clearEl = function ( el ) {
297
294
return function ( cb , eb ) {
298
- el . clear ( ) . then ( cb ) . thenCatch ( eb ) ;
295
+ el . clear ( ) . then ( cb , eb ) ;
299
296
} ;
300
297
} ;
301
298
302
299
exports . clickEl = function ( el ) {
303
300
return function ( cb , eb ) {
304
- el . click ( ) . then ( cb ) . thenCatch ( eb ) ;
301
+ el . click ( ) . then ( cb , eb ) ;
305
302
} ;
306
303
} ;
307
304
308
305
309
306
exports . takeScreenshot = function ( driver ) {
310
307
return function ( cb , eb ) {
311
308
driver . takeScreenshot ( )
312
- . then ( cb )
313
- . thenCatch ( eb ) ;
309
+ . then ( cb , eb ) ;
314
310
} ;
315
311
} ;
316
312
@@ -330,8 +326,7 @@ exports.saveScreenshot = function(fileName) {
330
326
if ( err ) return eb ( err ) ;
331
327
return cb ( ) ;
332
328
} ) ;
333
- } )
334
- . thenCatch ( eb ) ;
329
+ } , eb ) ;
335
330
} ;
336
331
} ;
337
332
} ;
@@ -351,33 +346,29 @@ exports.getWindow = function(window) {
351
346
exports . getWindowPosition = function ( window ) {
352
347
return function ( cb , eb ) {
353
348
return window . getPosition ( )
354
- . then ( cb )
355
- . thenCatch ( eb ) ;
349
+ . then ( cb , eb ) ;
356
350
} ;
357
351
} ;
358
352
359
353
exports . getWindowSize = function ( window ) {
360
354
return function ( cb , eb ) {
361
355
return window . getSize ( )
362
- . then ( cb )
363
- . thenCatch ( eb ) ;
356
+ . then ( cb , eb ) ;
364
357
} ;
365
358
} ;
366
359
367
360
exports . maximizeWindow = function ( window ) {
368
361
return function ( cb , eb ) {
369
362
return window . maximize ( )
370
- . then ( cb )
371
- . thenCatch ( eb ) ;
363
+ . then ( cb , eb ) ;
372
364
} ;
373
365
} ;
374
366
375
367
exports . setWindowPosition = function ( loc ) {
376
368
return function ( window ) {
377
369
return function ( cb , eb ) {
378
370
return window . setPosition ( loc . x , loc . y )
379
- . then ( cb )
380
- . thenCatch ( eb ) ;
371
+ . then ( cb , eb ) ;
381
372
} ;
382
373
} ;
383
374
} ;
@@ -386,8 +377,7 @@ exports.setWindowSize = function(size) {
386
377
return function ( window ) {
387
378
return function ( cb , eb ) {
388
379
return window . setSize ( size . width , size . height )
389
- . then ( cb )
390
- . thenCatch ( eb ) ;
380
+ . then ( cb , eb ) ;
391
381
} ;
392
382
} ;
393
383
} ;
@@ -399,32 +389,32 @@ exports.getWindowScroll = function(driver) {
399
389
x : window . scrollX ,
400
390
y : window . scrollY
401
391
} ;
402
- } ) . then ( cb ) . thenCatch ( eb ) ;
392
+ } ) . then ( cb , eb ) ;
403
393
} ;
404
394
} ;
405
395
406
396
exports . getWindowHandle = function ( driver ) {
407
397
return function ( cb , eb ) {
408
- driver . getWindowHandle ( ) . then ( cb ) . thenCatch ( eb ) ;
398
+ driver . getWindowHandle ( ) . then ( cb , eb ) ;
409
399
} ;
410
400
} ;
411
401
412
402
exports . _getAllWindowHandles = function ( driver ) {
413
403
return function ( cb , eb ) {
414
- driver . getAllWindowHandles ( ) . then ( cb ) . thenCatch ( eb ) ;
404
+ driver . getAllWindowHandles ( ) . then ( cb , eb ) ;
415
405
} ;
416
406
} ;
417
407
418
408
exports . switchTo = function ( handle ) {
419
409
return function ( driver ) {
420
410
return function ( cb , eb ) {
421
- return driver . switchTo ( ) . window ( handle ) . then ( cb ) . thenCatch ( eb ) ;
411
+ return driver . switchTo ( ) . window ( handle ) . then ( cb , eb ) ;
422
412
} ;
423
413
} ;
424
414
} ;
425
415
426
416
exports . close = function ( driver ) {
427
417
return function ( cb , eb ) {
428
- return driver . close ( ) . then ( cb ) . thenCatch ( eb ) ;
418
+ return driver . close ( ) . then ( cb , eb ) ;
429
419
} ;
430
420
} ;
0 commit comments