Skip to content

Commit

Permalink
initialize Screenshot class with Browser instance not a Driver instance
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed May 31, 2018
1 parent 274042b commit 0943e7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/watir/browser.rb
Expand Up @@ -290,7 +290,7 @@ def send_keys(*args)
#

def screenshot
Screenshot.new driver
Screenshot.new self
end

#
Expand Down
10 changes: 8 additions & 2 deletions lib/watir/screenshot.rb
@@ -1,8 +1,14 @@
module Watir
class Screenshot

def initialize(driver)
@driver = driver
def initialize(browser)
if browser.is_a? Selenium::WebDriver::Driver
Watir.logger.deprecate "Initializing `Watir::Screenshot` with a `Selenium::Driver` instance", "a `Watir::Browser` instance"
@driver = browser
else
@browser = browser
@driver = browser.wd
end
end

#
Expand Down

0 comments on commit 0943e7e

Please sign in to comment.