Created
July 23, 2018 16:31
-
-
Save twalpole/a71ec27599f0f7810c553a0df043b377 to your computer and use it in GitHub Desktop.
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/dsl" | |
require 'selenium/webdriver' | |
html = DATA.read | |
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
sess = Capybara::Session.new(:selenium_chrome, app) | |
sess.visit('/') | |
div1 = sess.find('#div1') | |
div2 = sess.find('#div2') | |
puts div1.matches_css?('div.a') | |
puts div2.matches_css?('div.a') | |
__END__ | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>title</title> | |
</head> | |
<body> | |
<div id="div1" class="a b c">Div 1</div> | |
<div id="div2" class="b c">Div 2</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment