are there any webkit equivalents to selenium's send_keys and dialog handling?

551 views
Skip to first unread message

David Morton

unread,
Jun 27, 2012, 1:33:55 AM6/27/12
to capybar...@googlegroups.com
Using selenium, I can send keystroke input to the page with:
 
   native.send_keys(:return)

and hit ok on dialogs with:

  page.driver.browser.switch_to.alert.accept

Are there any webkit alternatives?

Joe Ferris

unread,
Jun 28, 2012, 8:47:21 AM6/28/12
to capybar...@googlegroups.com
Hey David,

There currently isn't a quick way to send specific keys. However, you can use createEvent (https://developer.mozilla.org/en/DOM/document.createEvent) to simulate a lot of behavior together with Capybara's standard execute_script method.

Currently, capybara-webkit automatically accepts all alert/confirm dialogs.

-Joe

Jesse Cooke

unread,
Jun 28, 2012, 10:35:20 AM6/28/12
to capybar...@googlegroups.com

You can fake it with execute_script. Check out some helpers I've used for a while: https://gist.github.com/1693301

Reply all
Reply to author
Forward
0 new messages