Skip to content

Instantly share code, notes, and snippets.

@twalpole
Last active February 17, 2017 02:37
Show Gist options
  • Save twalpole/daba5dada9ebd9c35976abca87b3c331 to your computer and use it in GitHub Desktop.
Save twalpole/daba5dada9ebd9c35976abca87b3c331 to your computer and use it in GitHub Desktop.
require "capybara/dsl"
require "capybara/webkit"
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
sess = Capybara::Session.new(:webkit, app)
sess.visit("/")
sess.within_frame 'random' do
sess.assert_text 'content'
end
sess.switch_to_frame :top
sess.within_frame 'random' do
sess.assert_text 'content'
end
__END__
<!doctype html>
<html>
<body>
<iframe name="random" srcdoc="<p>content</p>">
</iframe>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment