6.1のサポートがぁぁぁあということで、7.0へ引っ越し作業中に
NoMethodError: undefined method `chrome' for Selenium::WebDriver::Remote::Capabilities:Class
ってエラーが発生
Capybara.register_driver :chrome_as_pc do |app|
caps = Selenium::WebDriver::Remote::Capabilities.chrome(
loggingPrefs: { browser: "ALL" },
chromeOptions: {
w3c: false,
args: [
"no-sandbox",
"headless",
"disable-gpu",
"window-size=1200,800",
"user-agent=Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11",
"disable-dev-shm-usage",
"lang=ja",
],
}
)
Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: caps)
end
↓↓↓↓↓↓↓
Capybara.register_driver :chrome_as_pc do |app|
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument("--headless")
options.add_argument("--no-sandbox")
options.add_argument("--disable-gpu")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--window-size=1200,800")
options.add_argument("--user-agent=Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11")
options.add_argument("--lang=ja")
Capybara::Selenium::Driver.new(app, browser: :chrome, options:)
end
でとりあえず動きました。