Search code examples
google-chromeselenium-webdriverrspeccapybaragoogle-chrome-headless

Selenium::WebDriver::Error::WebDriverError: no sessionId in returned payload


Tests suite with Rspec and Capybara was successful until now, but I suddendly got that error message without writing any new spec :

` Failure/Error: visit root_path

 Webdrivers::VersionError:
   Unable to find latest point release version for 115.0.5790. You appear to be using a non-production version of Chrome. Please set `Webdrivers::Chromedriver.required_version = <desired driver version>` to a known chromedriver version: https://chromedriver.storage.googleapis.com/index.html`

So I updated selenium-webdriver to 4.11.0 (and removed webdrivers gem)

But now I get that error :

`Failure/Error: visit root_path

 Selenium::WebDriver::Error::WebDriverError:
   no sessionId in returned payload`

Rails 7.0.6 Ruby 3.2.2

`Capybara.register_driver :chrome_headless do |app| options = Selenium::WebDriver::Chrome::Options.new

options.add_argument("--enable-features=NetworkService,NetworkServiceInProcess")
options.add_argument("--ignore-certificate-errors")
options.add_argument("--proxy-server=#{Billy.proxy.host}:#{Billy.proxy.port}")
options.add_argument("--disable-gpu") if Gem.win_platform?
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--window-size=1400,1400")
options.add_argument("--headless=new")
options.add_preference("intl.accept_languages", "en-US,en")
options.add_argument("--lang=en-US")
options.add_argument("--time-zone-for-testing=Europe/Paris")

Capybara::Selenium::Driver.new(
    app,
    browser: :chrome,
    options:,
    clear_local_storage: true,
    clear_session_storage: true
)

end

Capybara.configure do |config| config.javascript_driver = :chrome_headless end`


Solution

  • Update chromedriver following that documentation : How to Install Chrome Driver on Mac

    Downloading last version here : Chrome for Testing availability

    UPDATE : Just simply remove chromedriver from /usr/local/bin