@@ -51,16 +51,22 @@ export class Webdriver {
51
51
52
52
/**
53
53
* Mix a function from one object onto another. The function will still be
54
- * called in the context of the original object.
54
+ * called in the context of the original object. Any arguments of type
55
+ * `ElementFinder` will be unwrapped to their underlying `WebElement` instance
55
56
*
56
57
* @private
57
58
* @param {Object } to
58
59
* @param {Object } from
59
60
* @param {string } fnName
60
61
* @param {function= } setupFn
61
62
*/
62
- function mixin ( to : any , from : any , fnName : string , setupFn ?: Function ) {
63
+ function ptorMixin ( to : any , from : any , fnName : string , setupFn ?: Function ) {
63
64
to [ fnName ] = function ( ) {
65
+ for ( var i = 0 ; i < arguments . length ; i ++ ) {
66
+ if ( arguments [ i ] instanceof ElementFinder ) {
67
+ arguments [ i ] = arguments [ i ] . getWebElement ( ) ;
68
+ }
69
+ }
64
70
if ( setupFn ) {
65
71
setupFn ( ) ;
66
72
}
@@ -265,11 +271,11 @@ export class ProtractorBrowser extends Webdriver {
265
271
. forEach ( ( method : string ) => {
266
272
if ( ! this [ method ] && typeof webdriverInstance [ method ] == 'function' ) {
267
273
if ( methodsToSync . indexOf ( method ) !== - 1 ) {
268
- mixin (
274
+ ptorMixin (
269
275
this , webdriverInstance , method ,
270
276
this . waitForAngular . bind ( this ) ) ;
271
277
} else {
272
- mixin ( this , webdriverInstance , method ) ;
278
+ ptorMixin ( this , webdriverInstance , method ) ;
273
279
}
274
280
}
275
281
} ) ;
@@ -863,7 +869,7 @@ export class ProtractorBrowser extends Webdriver {
863
869
*/
864
870
navigate ( ) {
865
871
let nav = this . driver . navigate ( ) ;
866
- mixin ( nav , this , 'refresh' ) ;
872
+ ptorMixin ( nav , this , 'refresh' ) ;
867
873
return nav ;
868
874
}
869
875
0 commit comments