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 Firefox 121 start issue on Mac. #2043

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions lib/firefox/webdriver/builder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import { platform } from 'node:os';
import {
ServiceBuilder,
Options,
Expand Down Expand Up @@ -168,9 +169,36 @@ export async function configureBuilder(builder, baseDir, options) {
// https://bugzilla.mozilla.org/show_bug.cgi?id=1751196

if (!isAndroidConfigured(options)) {
ffOptions.setBinary(
firefoxTypes.length > 0 ? firefoxTypes[0] : Channel.RELEASE
);
// Fix for https://github.com/sitespeedio/browsertime/issues/2041
if (platform() === 'darwin') {
if (
!firefoxConfig.binaryPath &&
!firefoxConfig.nightly &&
!firefoxConfig.beta &&
!firefoxConfig.developer
) {
ffOptions.setBinary('/Applications/Firefox.app/Contents/MacOS/firefox');
Copy link

Choose a reason for hiding this comment

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

@soulgalore actually it would be better if you only set the app bundle on MacOS. This would prevent issues with the real binary that you usually should read out of the info.plist file. geckodriver itself will find the binary on its own.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm gonna remove this fix when it's fixed upstream. It was bold releasing 121 the week before Christmas so I just want to get it to work :)

Copy link

Choose a reason for hiding this comment

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

Ah, that's fine then. Thanks!

Copy link

Choose a reason for hiding this comment

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

It would be better to let Selenium Manager handle this. It will find the Firefox binary on the host and then match it with the appropriate GeckoDriver version.

} else if (firefoxConfig.nightly) {
ffOptions.setBinary(
'/Applications/Firefox Nightly.app/Contents/MacOS/firefox'
);
} else if (firefoxConfig.beta) {
ffOptions.setBinary(
'/Applications/Firefox Nightly.app/Contents/MacOS/firefox'
);
} else if (firefoxConfig.developer) {
ffOptions.setBinary(
'/Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox'
);
} else if (firefoxConfig.binaryPath) {
ffOptions.setBinary(firefoxConfig.binaryPath);
}
} else {
// See https://github.com/sitespeedio/browsertime/issues/2041
ffOptions.setBinary(
firefoxTypes.length > 0 ? firefoxTypes[0] : Channel.RELEASE
);
}
}

ffOptions.addArguments('-no-remote');
Expand Down