Sha256: 20bdd194e6d62172ba15f5e91e2cf7fa2f5289ee31a52745848bd5389bb4f82d

Contents?: true

Size: 566 Bytes

Versions: 14

Compression:

Stored size: 566 Bytes

Contents

# frozen_string_literal: true

module Webdrone
  class Browser
    def shot
      @shot ||= Shot.new self
    end
  end

  class Shot
    attr_reader :a0

    def initialize(a0)
      @a0 = a0
    end

    def screen(name)
      @counter = (@counter || 0) + 1
      filename = sprintf "screenshot-%04d-#{name}.png", @counter
      filename = File.join(@a0.conf.outdir, filename)
      ::Webdrone::MethodLogger.screenshot = filename
      @a0.driver.save_screenshot filename
    rescue StandardError => error
      Webdrone.report_error(@a0, error)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
webdrone-1.18.2 lib/webdrone/shot.rb
webdrone-1.18.0 lib/webdrone/shot.rb
webdrone-1.16.2 lib/webdrone/shot.rb
webdrone-1.16.0 lib/webdrone/shot.rb
webdrone-1.14.0 lib/webdrone/shot.rb
webdrone-1.12.0 lib/webdrone/shot.rb
webdrone-1.10.0 lib/webdrone/shot.rb
webdrone-1.8.12 lib/webdrone/shot.rb
webdrone-1.8.10 lib/webdrone/shot.rb
webdrone-1.8.8 lib/webdrone/shot.rb
webdrone-1.8.6 lib/webdrone/shot.rb
webdrone-1.8.4 lib/webdrone/shot.rb
webdrone-1.8.2 lib/webdrone/shot.rb
webdrone-1.8.0 lib/webdrone/shot.rb