File tree 1 file changed +11
-8
lines changed
javascript/node/selenium-webdriver/lib
1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -1045,13 +1045,15 @@ class WebDriver {
1045
1045
let cmd = new command . Command ( command . Name . FIND_ELEMENTS ) .
1046
1046
setParameter ( 'using' , locator . using ) .
1047
1047
setParameter ( 'value' , locator . value ) ;
1048
- let res = this . schedule ( cmd , 'WebDriver.findElements(' + locator + ')' ) ;
1049
- return res . catch ( function ( e ) {
1050
- if ( e instanceof error . NoSuchElementError ) {
1051
- return [ ] ;
1052
- }
1053
- throw e ;
1054
- } ) ;
1048
+ return this . schedule ( cmd , 'WebDriver.findElements(' + locator + ')' )
1049
+ . then (
1050
+ ( res ) => Array . isArray ( res ) ? res : [ ] ,
1051
+ ( e ) => {
1052
+ if ( e instanceof error . NoSuchElementError ) {
1053
+ return [ ] ;
1054
+ }
1055
+ throw e ;
1056
+ } ) ;
1055
1057
}
1056
1058
}
1057
1059
@@ -2076,7 +2078,8 @@ class WebElement {
2076
2078
command . Name . FIND_CHILD_ELEMENTS ) .
2077
2079
setParameter ( 'using' , locator . using ) .
2078
2080
setParameter ( 'value' , locator . value ) ;
2079
- return this . schedule_ ( cmd , 'WebElement.findElements(' + locator + ')' ) ;
2081
+ return this . schedule_ ( cmd , 'WebElement.findElements(' + locator + ')' )
2082
+ . then ( result => Array . isArray ( result ) ? result : [ ] ) ;
2080
2083
}
2081
2084
}
2082
2085
You can’t perform that action at this time.
0 commit comments