make sure only valid drivers take screenshots
This commit is contained in:
parent
00324b0538
commit
aba28d6961
@ -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]
|
||||||
@ -19,4 +21,5 @@ def take_screenshot(name, options = {})
|
|||||||
FileUtils.mkdir_p File.dirname(target)
|
FileUtils.mkdir_p File.dirname(target)
|
||||||
|
|
||||||
selenium.save_screenshot(target)
|
selenium.save_screenshot(target)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user