Skip to content

Instantly share code, notes, and snippets.

@buger
Created February 27, 2012 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buger/1926473 to your computer and use it in GitHub Desktop.
Save buger/1926473 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
require 'capybara/webkit'
body = "<html>
<body>
<div id='div_example'></div>
<iframe id='iframe_example'></iframe>
</body>
</html>
"
app = lambda do |env|
[200,
{ 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s },
[body]
]
end
session = Capybara::Session.new(:webkit_debug, app)
session.visit "/"
session.evaluate_script "document.getElementById('iframe_example').src = 'http://asdasdfdfddasdasdas.com';" # it fails because of this line
puts session.find "#div_example"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment