2
votes

Like the title says capybara is having trouble finding double_click:

undefined method `double_click' for #<Capybara::Node::Element:...>

Click works just fine as do most other methods. I'm using capybara 2.1.0, poltergeist 1.6.0 and phantomjs 1.9.7. Any ideas?

3
Welcome to StackOverflow. It may help if you add some code snippets to your question so people can analyze. Right now, they have to guess. - peter_the_oak
I think maybe you can check your plugins version, make sure it's lastest, it's a solution sometimes... - ethan
I upgraded to capybara 2.4.4 and now I get not implemented: base.double_click NotImplementedError: NotImplementedError - Alex Smith

3 Answers

1
votes

For posterity here's the solution:

I set javascript_driver:

Capybara.javascript_driver = :poltergeist

but not default_driver:

Capybara.default_driver = :poltergeist

0
votes

Are you sure you have a valid Capybara element that can be clicked on?

page.find('#lst-ib').double_click

The above works on Google.com

0
votes

For double click event, the below approach might help you solve your problem. I know its bit late but for people who might face similar issue in their automation work

On latest ruby capybara and selenium version use

element = page.find(:xpath,"//a[contains(text(), locator)]")
page.driver.browser.action.double_click(element.native).perform

for Old version pls use the below code:

element = page.find(:xpath,"//a[contains(text(), locator)]")
page.driver.browser.mouse.double_click(element.native)
  1. Find the element with either xpath or css.
  2. Use page.driver.browser.mouse.double_click(element.native) to perform the action