Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Chrome headless #936

Merged
merged 2 commits into from
Dec 18, 2023
Merged

Fix Chrome headless #936

merged 2 commits into from
Dec 18, 2023

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