You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.
Selenium supports sending arbitrary events to Dom nodes using the command fireEvent,
but the selenium web driver does not support this as far as I can tell. Though it does
support sending key events.
it "should allow triggering of custom JS events" do
pending "cannot figure out how to do this with selenium" if @session.mode == :selenium
@session.visit('/with_js')
@session.find(:css, '#with_focus_event').trigger(:focus)
@session.should have_css('#focus_event_triggered')
end
My motivation here is to get the trigger() method working for capybara so I can send
events like 'focus' to form controls.
Reported by jebarker on 2011-05-18 02:18:35
The text was updated successfully, but these errors were encountered:
It's a deliberate decision to not include this feature in WebDriver, since it's usually
a hack to work around synthesized events not behaving properly. We'd rather eliminate
this need by providing great support for native events, so we'll continue improving
that going forward. A user would never fire a focus event, they would click the form
control. That's what your tests should be doing as well.
If you really need to trigger a synthesized event, you can still implement that in
JavaScript and use Driver#execute_script (which is what e.g. watir-webdriver does:
https://github.com/jarib/watir-webdriver/blob/master/lib/watir-webdriver/elements/element.rb#L136).
Though beware that people who use this in their code are up for some surprises when
WebDriver's native event support improves (e.g. the events would fire twice).
Originally reported on Google Code with ID 1671
Reported by
jebarker
on 2011-05-18 02:18:35The text was updated successfully, but these errors were encountered: