Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ferrum v0.15 with proxy #34

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/vessel/driver/ferrum/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def create_page(proxy: nil)
options = {}
options.merge!(proxy: proxy) if proxy
page = browser.create_page(**options)
Page.new(page)
Page.new(page, context: browser.contexts[page.context_id])
end
end
end
Expand Down
5 changes: 3 additions & 2 deletions lib/vessel/driver/ferrum/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ class Page < Page

attr_reader :page

def initialize(page)
def initialize(page, context:)
super()
@page = page
@context = context
end

def close
page.context.dispose if page.use_proxy?
@context.dispose if page.use_proxy?
page.close
end

Expand Down
2 changes: 1 addition & 1 deletion vessel.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Gem::Specification.new do |s|

s.required_ruby_version = ">= 2.7.0"

s.add_runtime_dependency "ferrum", "~> 0.12"
s.add_runtime_dependency "ferrum", ">= 0.15"
s.add_runtime_dependency "mechanize", ">= 2.8.5"
s.add_runtime_dependency "nokogiri", "~> 1.13"
s.add_runtime_dependency "thor", "~> 1.2"
Expand Down
Loading