views:

61

answers:

3

Hi all,

I'm using the below command to set a text input value to "some value" however the value isn't set instantly, instead it's set as if it were typed by a user. That's ok for small values, but I'm using this method to insert a big text inside a textarea and I don't want the emulated typing to occur, I would like the value to be set instantly, like with a copy/paste.

browser.text_field(:attr,"val").set "some value"

ANSWER

Thanks to Shubham's reply I was able to track back the relevant method (.speed= at watir reference). Fast speed isn't a copy/paste emulation although it goes really fast. The proper speed option is :zippy and you set it as follows:

browser = Watir::IE.new
browser.speed= :zippy
+2  A: 

Before initializing watir add this option.

$FAST_SPEED  = 1
Shubham
thanks for your answer, I was able track the relevant method. I edited my question with the answer accordingly.
+1  A: 

This also works:

browser.text_field(:how => "what").value=("some value")
Željko Filipin
+2  A: 

I would recommend you to use speed :fast instead for all other text_fields, but the ones, which are large use #value= instead. If you use :zippy then no JavaScript events will be triggered and it might cause you painful moments...

Jarmo Pertman