# frozen_string_literal: true module Wayfarer module Networking class Ferrum include Strategy def renew_on [::Ferrum::DeadBrowserError] end def create ::Ferrum::Browser.new(Wayfarer.config.ferrum.options).tap do |browser| browser.headers.set(Wayfarer.config.network.http_headers) end end def destroy(instance) instance.reset instance.quit end def navigate(instance, url) instance.goto(url) # instance.network.wait_for_idle end def live(instance) success(url: instance.current_url, body: instance.body, status_code: instance.network.response.status, headers: instance.network.response.headers) end end end end