Class: Vessel::Driver::Mechanize::Driver

Inherits:
Vessel::Driver show all
Defined in:
lib/vessel/driver/mechanize/driver.rb

Instance Attribute Summary

Attributes inherited from Vessel::Driver

#browser, #proxy, #settings

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Vessel::Driver

direct_network_errors, driver_name, #go_to, #initialize, #restart

Constructor Details

This class inherits a constructor from Vessel::Driver

Class Method Details

.indirect_network_errorsObject



10
11
12
# File 'lib/vessel/driver/mechanize/driver.rb', line 10

def self.indirect_network_errors
  @indirect_network_errors ||= (super + [::Mechanize::ResponseCodeError]).freeze
end

Instance Method Details

#create_page(proxy: nil) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/vessel/driver/mechanize/driver.rb', line 24

def create_page(proxy: nil)
  mechanize = ::Mechanize.new do |m|
    m.user_agent = settings.dig(:headers, "User-Agent")
    m.set_proxy(proxy[:host], proxy[:port], proxy[:user], proxy[:password]) if proxy
  end

  Page.new(mechanize)
end

#startObject



16
17
18
# File 'lib/vessel/driver/mechanize/driver.rb', line 16

def start
  # Nothing to start here
end

#stopObject



20
21
22
# File 'lib/vessel/driver/mechanize/driver.rb', line 20

def stop
  # Nothing to stop here
end