6

I need to click enter key of keyboard in cucumber test cases. I have used selenium web-driver. Please tell me how to do it?

Andrei Botalov
  • 20,686
  • 11
  • 89
  • 123
vijay chouhan
  • 1,012
  • 8
  • 25
  • if your filling in a form see http://stackoverflow.com/questions/2797752/cucumber-capybara-and-selenium-submiting-a-form-without-a-button – Rachel Gallen Feb 10 '13 at 19:53

1 Answers1

9

You can use keys and ActionBuilder:

page.driver.browser.key_down(:enter).key_up(:enter).perform

or send_keys:

find(:id, 'my_id').native.send_keys(:enter)

Capybara doesn't currently contain its own API for pressing keys.

Andrei Botalov
  • 20,686
  • 11
  • 89
  • 123