require 'selenium-webdriver' %x[rm aipim/screenshots/*] Before('@javascript') do |scenario| page.driver.browser.manage.window.maximize end After('@screenshot') do return unless page.driver.browser sleep(1.0) page.driver.save_screenshot("aipim/screenshots/#{Time.now.to_i}.png") end