Skip to content

Instantly share code, notes, and snippets.

@twalpole
Created March 11, 2017 22:33
Show Gist options
  • Save twalpole/1147a74a892607f19b3a22d34dd937d3 to your computer and use it in GitHub Desktop.
Save twalpole/1147a74a892607f19b3a22d34dd937d3 to your computer and use it in GitHub Desktop.
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