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?
相关问题
- Selecting an item from a combo box selenium driver
- Selenium in Java is not finding element when using
- How to send text to the search field through Selen
- What is the difference in “find_element_by_xpath”
- MongoError: pool is draining, new operations prohi
Besides being able to click on button elements like @Jim Mitchener explained, you can also click on a part of a text in the following way:
This helper function does the same thing as
find(selector).click
, it finds the text element.I found this article very good, it explains different types of steps you can write in cucumber.
You can click on an element via
Capybara::Element.click
. I add the following for this in myweb_steps.rb
to click on divs.There is also
Element.trigger('mouseover')
which appears to enable hover albeit not working with Selenium.It is also very likely you will need to decorate your feature/scenario with Capybara's provided
@javascript
tag.