NMKP
NMKP

Reputation: 799

Mouse hover function in capybara?

I need to mouse hover an element using capybara. It's working fine in FF15. But not in FF13. Can anybody please help me to resolve this issue?

Upvotes: 1

Views: 850

Answers (2)

NMKP
NMKP

Reputation: 799

Finally, I found the solution

page.driver.browser.mouse.move_to(page.driver.browser.find_element(:id=>"locator"))

It's working fine.

Upvotes: 2

Alex D
Alex D

Reputation: 30445

I found a way to simulate "mouse hover" using Capybara + the Selenium driver:

module Capybara
  module Node
    class Element
      def hover
        @session.driver.browser.action.move_to(self.native).perform
      end
    end
  end
end

Upvotes: 0

Related Questions