File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
javascript/node/selenium-webdriver/lib Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -1045,13 +1045,15 @@ class WebDriver {
10451045 let cmd = new command . Command ( command . Name . FIND_ELEMENTS ) .
10461046 setParameter ( 'using' , locator . using ) .
10471047 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+ } ) ;
10551057 }
10561058 }
10571059
@@ -2076,7 +2078,8 @@ class WebElement {
20762078 command . Name . FIND_CHILD_ELEMENTS ) .
20772079 setParameter ( 'using' , locator . using ) .
20782080 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 : [ ] ) ;
20802083 }
20812084 }
20822085
You can’t perform that action at this time.
0 commit comments