Capybara selenium driver, hovering an element Capybara selenium driver, hovering an element selenium selenium

Capybara selenium driver, hovering an element


This has been added to Capybara:

find(:css, "#menu").hover


You could try displaying the element directly rather than mousing over.

page.execute_script("$('.thread_options').css('display','inline')")

Maybe also investigate the setting of ignore_hidden_elements. It defaults to false, but perhaps you have it set to true.

Or instead of display none, set the margin to a large negative value.

/* Move the element off the screen */.thread_options{  margin: -9999px 0 -9999px 0;}/* Set the desired display margins.btn_thread_options:hover .thread_options{  margin: 10px 0 10px 0;}


I found a way to simulate "mouse hover" using Capybara + the Selenium driver. This code is working for me:

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