Created
March 11, 2017 22:33
-
-
Save twalpole/1147a74a892607f19b3a22d34dd937d3 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" | |
require "capybara/poltergeist" | |
require "capybara/webkit" | |
html = DATA.read | |
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
[:selenium, :poltergeist, :webkit].each do |driver| | |
puts driver.to_s | |
sess = Capybara::Session.new(driver, app) | |
sess.visit("/") | |
puts sess.title | |
sess.within_frame 'random' do | |
puts sess.title | |
end | |
end | |
__END__ | |
<!doctype html> | |
<html> | |
<head> | |
<title>Main title</title> | |
</head> | |
<body> | |
<iframe name="random" srcdoc="<head><title>Frame title</title></head><body><p>content</p></body>"> | |
</iframe> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment