Skip to content

Commit

Permalink
fix: Adjust Chrome browser path and timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
goulvench committed Mar 3, 2025
1 parent 0fbde93 commit 1c3a855
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/models/browser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
class Browser
include Singleton

TIMEOUT = 5 # seconds
PAGE_TIMEOUT = 5 # seconds
PROCESS_TIMEOUT = 10 # seconds
WINDOW_SIZE = [1366, 768] # width, height

HEADERS = {
Expand Down Expand Up @@ -69,23 +70,22 @@ def settings
@settings ||= begin
{
headless: :new,
timeout: TIMEOUT,
timeout: PAGE_TIMEOUT,
window_size: WINDOW_SIZE,
process_timeout: PROCESS_TIMEOUT,
extensions: [Rails.root.join("vendor/javascript/stealth.min.js")],
browser_options: {
"disable-blink-features": "AutomationControlled",
"disable-popup-blocking": true,
"disable-notifications": true
}
}.tap do |options|
options[:browser_path] = browser_path if Rails.env.production?
options[:browser_path] = ENV["GOOGLE_CHROME_SHIM"] if Rails.env.production?
options[:proxy] = Rails.application.credentials.proxy if Rails.env.production?
end.freeze
end
end

def browser_path = ENV["GOOGLE_CHROME_BIN"]

def stub(request)
uri = URI.parse(request.url)
stub = WebMock::StubRegistry.instance.request_stubbed?(WebMock::RequestSignature.new(:get, uri))
Expand Down

0 comments on commit 1c3a855

Please sign in to comment.