Module: Webshot

Defined in:
lib/webshot.rb,
lib/webshot/errors.rb,
lib/webshot/version.rb,
lib/webshot/screenshot.rb

Defined Under Namespace

Classes: Screenshot, WebshotError

Constant Summary collapse

VERSION =
'0.0.11'
@@width =
1024
@@height =
768
@@user_agent =
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.capybara_setup!Object

Capibara setup



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/webshot.rb', line 31

def self.capybara_setup!
  # By default Capybara will try to boot a rack application
  # automatically. You might want to switch off Capybara's
  # rack server if you are running against a remote application
  Capybara.run_server = false
  Capybara.register_driver :poltergeist do |app|
    Capybara::Poltergeist::Driver.new(app, {
      # Raise JavaScript errors to Ruby
      js_errors: false,
      # Additional command line options for PhantomJS
      phantomjs_options: ['--ignore-ssl-errors=yes', '--ssl-protocol=any']
    })
  end
  Capybara.current_driver = :poltergeist
end

.setup {|_self| ... } ⇒ Object

Customize settings

Yields:

  • (_self)

Yield Parameters:

  • _self (Webshot)

    the object that the method was called on



26
27
28
# File 'lib/webshot.rb', line 26

def self.setup
  yield self
end

Instance Method Details

#widthObject

Browser settings Width



14
# File 'lib/webshot.rb', line 14

mattr_accessor :width