Sha256: 2d15843d0170bc4d0ddfe0020f855a0aa06441a3592a6bc42bce9c27ea41d699
Contents?: true
Size: 652 Bytes
Versions: 1
Compression:
Stored size: 652 Bytes
Contents
require "capybara" require "capybara/poltergeist" module Undead class Agent DEFAULT_OPTIONS = { js_errors: false, timeout: 1000, } Capybara.javascript_driver = :poltergeist Capybara.default_selector = :css def initialize(options = {}) Capybara.register_driver :poltergeist do |app| Capybara::Poltergeist::Driver.new(app, DEFAULT_OPTIONS.merge(options)) end @session = Capybara::Session.new(:poltergeist) @session.driver.headers = { 'User-Agent' => "Mozilla/5.0 (Macintosh; Intel Mac OS X)" } end def get(url) @session.visit url @session.html end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
undead-0.1.1 | lib/undead/agent.rb |