Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I send key stroke Enter in Watir

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?

like image 451
user1771980 Avatar asked Feb 13 '13 17:02

user1771980


1 Answers

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

like image 170
Željko Filipin Avatar answered Oct 12 '22 15:10

Željko Filipin