This repository was archived by the owner on Jan 17, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-27
lines changed Expand file tree Collapse file tree 1 file changed +6
-27
lines changed Original file line number Diff line number Diff line change @@ -111,19 +111,11 @@ function _find(nothing) {
111
111
return function ( driver ) {
112
112
return function ( by ) {
113
113
return function ( cb ) {
114
- driver . isElementPresent ( by )
115
- . then ( function ( is ) {
116
- if ( is ) {
117
- var el = driver . findElement ( by ) ;
118
- return cb ( just ( el ) ) ;
119
- } else {
120
- return cb ( nothing ) ;
121
- }
122
- } )
123
- . thenCatch ( function ( ) {
124
- return cb ( nothing ) ;
125
- } ) ;
126
-
114
+ driver . findElement ( by ) . then ( function ( el ) {
115
+ return cb ( just ( el ) ) ;
116
+ } ) . thenCatch ( function ( ) {
117
+ return cb ( nothing ) ;
118
+ } ) ;
127
119
} ;
128
120
} ;
129
121
} ;
@@ -133,20 +125,7 @@ function _find(nothing) {
133
125
function _exact ( driver ) {
134
126
return function ( by ) {
135
127
return function ( cb , eb ) {
136
- driver . isElementPresent ( by )
137
- . then ( function ( is ) {
138
- if ( is ) {
139
- var el = driver . findElement ( by ) ;
140
- return cb ( el ) ;
141
- } else {
142
- var error = "couldn't find element using locator " + by . toString ( ) ;
143
- return eb ( new Error ( error ) ) ;
144
- }
145
- } )
146
- . thenCatch ( function ( e ) {
147
- return eb ( e ) ;
148
- } ) ;
149
-
128
+ driver . findElement ( by ) . then ( cb ) . thenCatch ( eb ) ;
150
129
} ;
151
130
} ;
152
131
}
You can’t perform that action at this time.
0 commit comments