Skip to content

Commit

Permalink
Better browser path detection for Firefox (only for Linux)
Browse files Browse the repository at this point in the history
  • Loading branch information
YusukeIwaki committed Nov 23, 2021
1 parent b1cad37 commit 05b55f1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/puppeteer/launcher/firefox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def launch(options = {})
if @launch_options.channel
executable_path_for_channel(@launch_options.channel.to_s)
else
@launch_options.executable_path || executable_path_for_channel('nightly')
@launch_options.executable_path || fallback_executable_path
end
runner = Puppeteer::BrowserRunner.new(firefox_executable, firefox_arguments, temporary_user_data_dir)
runner.start(
Expand Down Expand Up @@ -138,7 +138,15 @@ def executable_path(channel: nil)
if channel
executable_path_for_channel(channel.to_s)
else
fallback_executable_path
end
end

private def fallback_executable_path
if Puppeteer.env.windows? || Puppeteer.env.darwin?
executable_path_for_channel('firefox')
else
Puppeteer::ExecutablePathFinder.new('firefox').find_first
end
end

Expand Down

0 comments on commit 05b55f1

Please sign in to comment.