Created
September 19, 2016 16:00
-
-
Save twalpole/b4fdfc23baf22ad7f8f645605c4cbfb7 to your computer and use it in GitHub Desktop.
Test #hover with example html
This file contains hidden or 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
require "capybara" | |
require "benchmark" | |
# require "capybara/poltergeist" | |
# require "capybara/webkit" | |
html = DATA.read | |
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
sess = Capybara::Session.new(:selenium, app) | |
sess.visit("/") | |
sess.find(".menu1").hover | |
sess.find("#m1choice1link").click | |
__END__ | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Contact List Application</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/js/bootstrap.min.js"></script> | |
<style> | |
.dropdown-menu{ | |
top: 0; | |
left: 100%; | |
} | |
.dropdown:hover .dropdown-menu{ | |
display: block; | |
} | |
</style> | |
</head> | |
<body ng-app="myApp"> | |
<ul class="nav nav-stacked"> | |
<li class="dropdown"> | |
<div class="btn-group"> | |
<a class="btn dropdown-toggle menu1" data-toggle="dropdown" href="#"> | |
Menu 1 | |
<i class="icon icon-caret-right"></i> | |
</a> | |
<ul class="dropdown-menu"> | |
<li><a href="#" id="m1choice1link">Choice1</a></li> | |
<li><a href="#" id="m1choice2link">Choice2</a></li> | |
<li><a href="#"id="m1choice3link">Choice3</a></li> | |
<li class="divider"></li> | |
<li><a href="#">Choice..</a></li> | |
</ul> | |
</div> | |
</li> | |
<li class="dropdown"> | |
<div class="btn-group"> | |
<a class="btn dropdown-toggle menu2" data-toggle="dropdown" href="#"> | |
Menu 2 | |
<i class="icon icon-caret-right"></i> | |
</a> | |
<ul class="dropdown-menu"> | |
<li><a href="#">Choice1</a></li> | |
<li><a href="#">Choice2</a></li> | |
<li><a href="#">Choice3</a></li> | |
<li class="divider"></li> | |
<li><a href="#">Choice..</a></li> | |
</ul> | |
</div> | |
</li> | |
</ul> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment