How to send key stroke Enter in Watir

keystrokewatir

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?

Best Answer

browser.send_keys :enter should do the job. Please provide link to the page, link to a similar page, or relevant HTML.

Related Topic