Alex Rivera | Logout

How do I send key stroke Enter in Watir

Asked 2013-02-13T17:04:21.790
11

I need to automate the action of hitting 'Enter' key on keyboard after entering a text in a text field. I tried @browser.send_keys :enter but that does not do the action. also have tried @browser.text_field(:name => 'q').send_keys :enter or @browser.text_field(:name => 'q').focus and then send_keys. But has not helped.

@browser.send_keys("{ENTER}")

does not help this too, this actually types ("{ENTER}")

Please let me know other ways of doing?

Edit
Report

1 Answer

7

try browse.send_keys :return

found it here http://watir.com/guides/special-keys/

answered 2013-02-13T22:36:32.933

Your Answer