-
Notifications
You must be signed in to change notification settings - Fork 5
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
Disable Chrome code signing, when used on Mac #53
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
=========================================
Coverage 84.40% 84.40%
Complexity 196 196
=========================================
Files 1 1
Lines 500 500
=========================================
Hits 422 422
Misses 78 78 ☔ View full report in Codecov by Sentry. |
Tested Chromedriver 131.0.6778.139 and the issue is still there. Even though https://issues.chromium.org/issues/379125944 reported (if I'm reading that page correctly), that issue was fixed in the 131.0.6778.70. 😞 |
I'm using other arguments in the same way you did it (e.g. Could you maybe run it and then either inspect selenium settings in |
Are you using Chrome for Testing or a stable Chrome/Chromium release ? |
I'm using Brave Browser (which is Chromium-based). I guess specifying |
This is some sort of security/sandboxing , are we sure we want to disable it? I'd rather document it. MacOS itself should handle cleanup, plus how many people or running Chromedriver on MacOS for CI. |
Off-topic warning I have mixed feelings about the default capabilities (including the current one). Cons:
Pros:
In general, I feel like we should have some sort of mechanism (or a sub-project / sub-driver?) to handle capabilities better. For example, it would be nice for our users to just pass a "enable_headless" config which we translate to the right set of capabilities for the specified browser. I haven't spent too much time thinking about this, so it would be really nice if someone else took over or thinks it over. |
@uuf6429 , I've found out why driver defaults weren't used. I'm passing this to allow chromedriver to operate on non-Chrome (Chromium-based) Web Browser: 'goog:chromeOptions' => array(
'binary' => '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'
), and that completely replaced driver-provided defaults: 'goog:chromeOptions' => [
// disable "Chrome is being controlled.." notification bar
'excludeSwitches' => ['enable-automation'],
'args' => array(
// disable browser folder cloning on Mac, when tests are executed
'disable-features=MacAppCodeSignClone',
),
], . The mix-and-match approach and on/off switch, as @oleg-andreyev proposed, for default desired capabilities is an interesting thing to discuss.
@oleg-andreyev , we're discussing this a bit in the #51 . Probably we can have
@oleg-andreyev , I have no idea what this functionality is (probably Chromium source code at https://source.chromium.org/search?q=MacAppCodeSignClone&sq=&ss=chromium can reveal it), but it surely eats a lot of disk space pretty quickly and since on macOS you don't reboot quite often to auto-clear temp folder (as you do on Windows) you can run out of disk space soon enough. Before creating a PR I prefer to execute the whole Selenium-based test suite locally to see if it passes and only then let GitHub Actions run it. This would save me time waiting for GitHub Actions to crash after some time when I can see the same crash locally and already start to fix things. |
The comments in https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/mac/code_sign_clone_manager.h?q=MacAppCodeSignClone&ss=chromium explain a lot why this was done. If I've understood correctly, then it was done for updating to new version purposes and there is a background process to delete the cloned folder. My guess is that this background process doesn't work or is stopped as long as Selenium-started browser exists as part of I have no idea really why the clones are not deleted, when they should. More links:
|
I've created #54 for discussing general problems with desired capability handling. |
When executing tests in Google Chrome (or any Chromium-based Web Browser) on Mac you'll notice you're temp folder starts to grow faster than lightning strikes.
This happens because upon launching a Web Browser copies itself (whole ~300MB folder) into a temp folder. When the Web Browser exists that temp folder isn't deleted.
Since numerous Selenium Server sessions are started/stopped during the test suite run you'll get numerous ~300MB folders residing under a temp folder.
Solution:
--disable-features=MacAppCodeSignClone
as Chrome arguments in WebDriver configuration.This PR does the latter.
P.S.
@uuf6429, I can't seem to get it working. May be related to the bug solved in the #51 .