From 08a8fd683457bc2a635756a25f250614b0163567 Mon Sep 17 00:00:00 2001 From: Jonas Nicklas Date: Tue, 20 Nov 2012 14:33:47 +0100 Subject: [PATCH] Use JS to clear field, should be more performant --- lib/capybara/selenium/node.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/capybara/selenium/node.rb b/lib/capybara/selenium/node.rb index 696a6a8d..8da4906d 100644 --- a/lib/capybara/selenium/node.rb +++ b/lib/capybara/selenium/node.rb @@ -32,8 +32,8 @@ class Capybara::Selenium::Node < Capybara::Driver::Node path_names = value.to_s.empty? ? [] : value native.send_keys(*path_names) elsif tag_name == 'textarea' or tag_name == 'input' - chars = native[:value].size - native.send_keys(([:right] * chars) + ([:backspace] * chars) + [ value.to_s ]) + driver.browser.execute_script "arguments[0].value = ''", native + native.send_keys(value.to_s) end end