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
1 changed files with 11 additions and 8 deletions

View File

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