Class: Webdrone::Shot

Inherits:
Object
  • Object
show all
Defined in:
lib/webdrone/logg.rb,
lib/webdrone/shot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a0) ⇒ Shot

Returns a new instance of Shot.



13
14
15
# File 'lib/webdrone/shot.rb', line 13

def initialize(a0)
  @a0 = a0
end

Instance Attribute Details

#a0Object (readonly)

Returns the value of attribute a0.



11
12
13
# File 'lib/webdrone/shot.rb', line 11

def a0
  @a0
end

Instance Method Details

#screen(name) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/webdrone/shot.rb', line 17

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