Created
May 30, 2012 14:58
-
-
Save metaskills/2836849 to your computer and use it in GitHub Desktop.
Basic Save & Open Page For Poltergeist
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
def save_and_open_page | |
dir = "#{Rails.root}/tmp/cache/capybara" | |
file = "#{dir}/#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}.png" | |
FileUtils.mkdir_p dir | |
page.driver.render file | |
wait_until { File.exists?(file) } | |
system "open #{file}" | |
end |
wait_until has been removed from capybara.
while !File.exists?(file) do
sleep 1
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yay Ruby!!