Created
July 11, 2017 00:16
-
-
Save twalpole/6f549a27916b1fa2a8d4ef23677f58b2 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 'capybara/poltergeist' | |
html = DATA.read | |
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
sess = Capybara::Session.new(:poltergeist, app) | |
sess.visit('/') | |
btn = sess.find('#submit_payment') | |
puts btn[:disabled] | |
sess.save_and_open_screenshot | |
sess.click_button('Enable') | |
sleep 0.5 | |
puts btn[:disabled] | |
sess.save_and_open_screenshot | |
__END__ | |
<!doctype html> | |
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-3.2.1.js" integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=" crossorigin="anonymous"></script> | |
</head> | |
<body> | |
<button id="submit_payment" disabled>Blah</button> | |
<button type="button" onclick="$('#submit_payment').prop('disabled', false)">Enable</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment