I am trying to test an inplace editor using Cucumber/Capybara/Selenium stack, but my problem is that the editor is activated by clicking a div and not a link or button. I can not seem to figure out how to get Capybara to do this. Is there a way of doing this?
A:
You can click on an element via Capybara::Element.click. I add the following for this in my web_steps.rb to click on divs.
When /^(?:|I )click within "([^"]*)"$/ do |selector|
find(selector).click
end
There is also Element.trigger(event) which appears to enable hover albeit not working with Selenium. I have not used this so I'm not sure if the correct syntax is trigger(:mouseover)
or what. You will have to experiment.
It is also very likely you will need to decorate your feature/scenario with Capybara's provided @javascript
tag.
jcm
2010-10-08 10:30:55