Skip to content

Commit cd46d55

Browse files
committed
[rb] support remote sending nil to #send_keys
1 parent a8659ce commit cd46d55

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

rb/lib/selenium/webdriver/remote/bridge.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def send_keys_to_element(element, keys)
392392
# TODO: rework file detectors before Selenium 4.0
393393
if @file_detector
394394
local_files = keys.first&.split("\n")&.map { |key| @file_detector.call(Array(key)) }&.compact
395-
if local_files.any?
395+
if local_files&.any?
396396
keys = local_files.map { |local_file| upload(local_file) }
397397
keys = Array(keys.join("\n"))
398398
end

rb/spec/integration/selenium/webdriver/element_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ module WebDriver
8787
end
8888
end
8989

90+
it 'should send empty keys' do
91+
driver.navigate.to url_for('formPage.html')
92+
element = wait_for_element(id: 'working')
93+
element.send_keys
94+
expect(element.text).to be_empty
95+
end
96+
97+
9098
it 'should send string keys' do
9199
driver.navigate.to url_for('formPage.html')
92100
wait_for_element(id: 'working')

0 commit comments

Comments
 (0)