Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions javascript/node/selenium-webdriver/lib/webdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2752,6 +2752,7 @@ class WebElement {
keys = await this.driver_.fileDetector_.handleFile(this.driver_, keys.join(''))
} catch (ex) {
this.log_.severe('Error trying parse string as a file with file detector; sending keys instead' + ex)
keys = keys.join('')
}

return this.execute_(
Expand Down
26 changes: 26 additions & 0 deletions javascript/node/selenium-webdriver/test/lib/webdriver_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,32 @@ describe('WebDriver', function () {

return driver.findElement(By.id('foo')).sendKeys('original/', 'path')
})

it('sendKeysWithAFileDetector_handlerError', function () {
let executor = new FakeExecutor()
.expect(CName.FIND_ELEMENT, {
using: 'css selector',
value: '*[id="foo"]',
})
.andReturnSuccess(WebElement.buildId('one'))
.expect(CName.SEND_KEYS_TO_ELEMENT, {
id: WebElement.buildId('one'),
text: 'original/path',
value: 'original/path'.split(''),
})
.andReturnSuccess()
.end()

let driver = executor.createDriver()
let handleFile = function (d, path) {
assert.strictEqual(driver, d)
assert.strictEqual(path, 'original/path')
return Promise.reject('unhandled file error')
}
driver.setFileDetector({ handleFile })

return driver.findElement(By.id('foo')).sendKeys('original/', 'path')
})
})

describe('switchTo()', function () {
Expand Down
Loading