File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
javascript/node/selenium-webdriver Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -2752,6 +2752,7 @@ class WebElement {
27522752 keys = await this . driver_ . fileDetector_ . handleFile ( this . driver_ , keys . join ( '' ) )
27532753 } catch ( ex ) {
27542754 this . log_ . severe ( 'Error trying parse string as a file with file detector; sending keys instead' + ex )
2755+ keys = keys . join ( '' )
27552756 }
27562757
27572758 return this . execute_ (
Original file line number Diff line number Diff line change @@ -932,6 +932,32 @@ describe('WebDriver', function () {
932932
933933 return driver . findElement ( By . id ( 'foo' ) ) . sendKeys ( 'original/' , 'path' )
934934 } )
935+
936+ it ( 'sendKeysWithAFileDetector_handlerError' , function ( ) {
937+ let executor = new FakeExecutor ( )
938+ . expect ( CName . FIND_ELEMENT , {
939+ using : 'css selector' ,
940+ value : '*[id="foo"]' ,
941+ } )
942+ . andReturnSuccess ( WebElement . buildId ( 'one' ) )
943+ . expect ( CName . SEND_KEYS_TO_ELEMENT , {
944+ id : WebElement . buildId ( 'one' ) ,
945+ text : 'original/path' ,
946+ value : 'original/path' . split ( '' ) ,
947+ } )
948+ . andReturnSuccess ( )
949+ . end ( )
950+
951+ let driver = executor . createDriver ( )
952+ let handleFile = function ( d , path ) {
953+ assert . strictEqual ( driver , d )
954+ assert . strictEqual ( path , 'original/path' )
955+ return Promise . reject ( 'unhandled file error' )
956+ }
957+ driver . setFileDetector ( { handleFile } )
958+
959+ return driver . findElement ( By . id ( 'foo' ) ) . sendKeys ( 'original/' , 'path' )
960+ } )
935961 } )
936962
937963 describe ( 'switchTo()' , function ( ) {
You can’t perform that action at this time.
0 commit comments