Edited at

Capybara の headless chrome で Accept-Language ヘッダを送る設定

More than 1 year has passed since last update.

Capybara.register_driver :headless_chrome do |app|

Capybara::Selenium::Driver.new(app,
browser: :chrome,
desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(),
options: Selenium::WebDriver::Chrome::Options.new(
args: %w(--headless --disable-gpu --lang=ja-JP)
)
)
end

ポイントは、--lang=オプションを使うこと。

https://peter.sh/experiments/chromium-command-line-switches/ あたりに載ってた。