make sure only valid drivers take screenshots

This commit is contained in:
John Bintz 2012-07-25 14:34:49 -04:00
parent 00324b0538
commit aba28d6961

View File

@ -7,9 +7,11 @@ module CukePack
end
def take_screenshot(name, options = {})
selenium = Capybara.current_session.driver.browser
if selenium.respond_to?(:manage)
options = CukePack.screenshot_options.merge(options)
selenium = Capybara.current_session.driver.browser
selenium.manage.window.resize_to(options[:width], options[:height])
target = options[:directory]
@ -19,4 +21,5 @@ def take_screenshot(name, options = {})
FileUtils.mkdir_p File.dirname(target)
selenium.save_screenshot(target)
end
end