It takes around 4-5 seconds to set large text to text_field using watir-webdriver. I have also tried value method, but still it's very slow.
I have found a workaround for this on Windows using Clipboard gem and send_keys [:control, "v"], however this does not really work with headless linux. Any suggestion on this?
Inputting large values can be slow because the characters are inputted one at a time. This is to trigger each of the key events.
Assuming your application does not care about the events triggered by inputting the field, you could directly set the value via JavaScript.
Watir 6.8+
Watir now provides a
#set!
method to do this:Pre-Watir 6.8
Prior to v6.8 (when this was originally answered), this needed to be done manually via
#execute_script
:Performance Comparison
Even with this small text, you can see that
execute_script
is much faster. A benchmark:The results: