Last active
December 16, 2015 20:00
-
-
Save adarapata/5489576 to your computer and use it in GitHub Desktop.
Capybaraでリンク属性の無い要素をクリックしたりホバーしたりするmodule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
module Capybara | |
class Session | |
def mouse_over(dom) | |
execute_trigger(dom, "mouseover") | |
end | |
def mouse_click(dom) | |
execute_trigger(dom, "click") | |
end | |
private | |
def execute_trigger(dom, event) | |
self.execute_script('$("' + dom + '").trigger("' + event + '")') | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment