Use JS to clear field, should be more performant

This commit is contained in:
Jonas Nicklas 2012-11-20 14:33:47 +01:00
parent 7859efb757
commit 08a8fd6834
1 changed files with 2 additions and 2 deletions

View File

@ -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