1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

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

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