Skip to content

Fix Chrome headless#936

Merged
etiennebarrie merged 2 commits intomainfrom
fix-chrome-headless
Dec 18, 2023
Merged

Fix Chrome headless#936
etiennebarrie merged 2 commits intomainfrom
fix-chrome-headless

Conversation

@etiennebarrie
Copy link
Member

With Chrome 120, the default headless is now a different binary, causing Selenium to fail to inject its extensions, we can't get logs, etc. See more in SeleniumHQ/selenium#13271

Instead of waiting for a new release of selenium-webdriver that includes the fix to continue using the old headless, or configuring Selenium to use an older version of Chrome, this moves to the new headless Chrome.

I had two issues doing that:

  1. The preferences to configure the download path does not seem respected by the new headless Chrome, but I found that Selenium had some code in place to configure the download path, so I used that instead.
    Unfortunately the method seems deprecated in the Chrome DevTools Protocol: https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setDownloadBehavior (permalink) but for now that should do it.
  2. Rails 6.0 was adding --headless after our --headless=new, so we were still seeing the problems with 6.0, I monkey-patched the problematic method.

Copy link
Contributor

@nvasilevski nvasilevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants