Skip to content

Instantly share code, notes, and snippets.

@twalpole
Created November 28, 2016 19:11
Show Gist options
  • Save twalpole/4775247a2ed6389a58a39e67f47dee84 to your computer and use it in GitHub Desktop.
Save twalpole/4775247a2ed6389a58a39e67f47dee84 to your computer and use it in GitHub Desktop.
require "capybara/poltergeist"
# require "selenium-webdriver"
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
# sess = Capybara::Session.new(:selenium, app)
sess = Capybara::Session.new(:poltergeist, app)
sess.visit("/")
puts "eval is nil" if sess.evaluate_script('parseInt(undefined)').nil?
puts "exec is nil" if sess.execute_script('parseInt(undefined)').nil?
__END__
<!doctype html>
<html lang="en">
<head>
</head>
<body>
<div id="mine">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment