How to emulate mouse hover with Capybara

前端 未结 4 1186
北荒
北荒 2020-12-13 06:27

Basically, what I\'m trying to do is click on a button that becomes visible when hovering another element (its parent).

I have tried to use trigger.(\'mouseove

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-13 07:08

    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
    

提交回复
热议问题