Read more

How to doubleclick in Selenium

Dominik Schöler
February 10, 2014Software engineer at makandra GmbH

When removing the w3c option from Selenium, this workaround was deprecated. The working Monkeypacth would be session.driver.browser.action.double_click(self.native).perform, but Capybara Elements nowadays support the double_click method natively, so the Monkeypatch can be removed entirely!

Put the attached file into features/support/.

Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

Example usage:

When /^I open the task named "(.+?)"$/ do |task_name|
  task = page.all('.task').detect do |t|
    t.find('.label').text.downcase == task_name.downcase
  end
  
  task.double_click
end

Note: only Selenium understands doubleclicks.\
Credits: the attached Capybara issue discussion.

Posted by Dominik Schöler to makandra dev (2014-02-10 17:23)