Skip to content

Commit

Permalink
Use detected chrome path as default
Browse files Browse the repository at this point in the history
  • Loading branch information
dvic committed Jul 24, 2023
1 parent cdff788 commit feec42c
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions lib/wallaby/chrome.ex
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,18 @@ defmodule Wallaby.Chrome do
opts[:metadata]
)

chrome_options =
maybe_put_chrome_executable(%{
args: [
"--no-sandbox",
"window-size=1280,800",
"--disable-gpu",
"--headless",
"--fullscreen",
"--user-agent=#{user_agent}"
]
})

%{
javascriptEnabled: false,
loadImages: false,
Expand All @@ -563,19 +575,17 @@ defmodule Wallaby.Chrome do
loggingPrefs: %{
browser: "DEBUG"
},
chromeOptions: %{
args: [
"--no-sandbox",
"window-size=1280,800",
"--disable-gpu",
"--headless",
"--fullscreen",
"--user-agent=#{user_agent}"
]
}
chromeOptions: chrome_options
}
end

defp maybe_put_chrome_executable(chrome_options) do
case find_chrome_executable() do
{:ok, chrome_binary} -> Map.put(chrome_options, :binary, chrome_binary)
_ -> chrome_options
end
end

defp put_headless_config(capabilities, opts) do
headless? = resolve_opt(opts, :headless)

Expand Down

0 comments on commit feec42c

Please sign in to comment.