Module: Capybara::Apparition::Browser::Render

Included in:
Capybara::Apparition::Browser
Defined in:
lib/capybara/apparition/browser/render.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#zoom_factor=(value) ⇒ Object (writeonly)

Sets the attribute zoom_factor

Parameters:

  • value

    the value to set the attribute zoom_factor to.



17
18
19
# File 'lib/capybara/apparition/browser/render.rb', line 17

def zoom_factor=(value)
  @zoom_factor = value
end

Instance Method Details

#paper_size=(size) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/capybara/apparition/browser/render.rb', line 19

def paper_size=(size)
  @paper_size = if size.is_a? Hash
    size
  else
    PAPER_SIZES.fetch(size) do
      raise_errors ArgumentError, "Unknwon paper size: #{size}"
    end
  end
end

#render(path, options = {}) ⇒ Object



6
7
8
9
10
# File 'lib/capybara/apparition/browser/render.rb', line 6

def render(path, options = {})
  check_render_options!(options, path)
  img_data = current_page.render(options)
  File.open(path, 'wb') { |f| f.write(Base64.decode64(img_data)) }
end

#render_base64(options = {}) ⇒ Object



12
13
14
15
# File 'lib/capybara/apparition/browser/render.rb', line 12

def render_base64(options = {})
  check_render_options!(options)
  current_page.render(options)
end