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

Regression: CHROMEDRIVER_FILEPATH doesn't work #462

Closed
jan-molak opened this issue Apr 9, 2024 · 5 comments
Closed

Regression: CHROMEDRIVER_FILEPATH doesn't work #462

jan-molak opened this issue Apr 9, 2024 · 5 comments
Assignees
Labels

Comments

@jan-molak
Copy link

jan-molak commented Apr 9, 2024

Hey @giggio

It looks like v122.0.0 introduced a regression (also present in v123) similar to #424, where specifying CHROMEDRIVER_FILEPATH breaks the installation process.

I believe the culprit is the return statement on line 66:

if (!chromedriverIsAvailable) {
console.log('Current existing ChromeDriver binary is unavailable, proceeding with download and extraction.');
const configuredfilePath = process.env.npm_config_chromedriver_filepath || process.env.CHROMEDRIVER_FILEPATH;
if (configuredfilePath) {
console.log('Using file: ', configuredfilePath);
return configuredfilePath;
}
if (useLegacyMethod)
await this.downloadFileLegacy(legacyCdnUrl, downloadedFile, chromedriverVersion);
else
await this.downloadFile(cdnUrl, downloadedFile, chromedriverVersion, platform);
await this.extractDownload(extractDirectory, chromedriverBinaryFilePath, downloadedFile);
}
const libPath = path.join(__dirname, 'lib', 'chromedriver');
await this.copyIntoPlace(tmpPath, libPath);
this.fixFilePermissions();
console.log('Done. ChromeDriver binary available at', helper.path);
} catch (err) {
console.error('ChromeDriver installation failed', err);

This return statement prevents the script from proceeding to line 75 and copying the existing user-specified binary to chromedriver/lib/chromedriver:

await this.copyIntoPlace(tmpPath, libPath);
this.fixFilePermissions();
console.log('Done. ChromeDriver binary available at', helper.path);

Since the binary is never copied to the correct destination, calling require('chromedriver').path returns a path that points to a non-existent location, which then confuses automation frameworks:

module.exports = {
path: crpath,
version,
start,

I believe that to solve this, the install script should copy the user-specified binary to the expected location.

jan-molak added a commit to jan-molak/node-chromedriver that referenced this issue Apr 10, 2024
jan-molak added a commit to serenity-js/serenity-js that referenced this issue Apr 10, 2024
jan-molak added a commit to serenity-js/serenity-js that referenced this issue Apr 10, 2024
@giggio giggio added the bug label Apr 10, 2024
@giggio giggio self-assigned this Apr 10, 2024
@giggio
Copy link
Owner

giggio commented Apr 10, 2024

Yes, this is most likely a bug. It came from the refactoring I did earlier. I see you submitted a PR, I'll take a look into it.

@giggio giggio closed this as completed in 283b9f4 Apr 10, 2024
@giggio
Copy link
Owner

giggio commented Apr 10, 2024

I just fixed it and will release momentarily. If the fix does not work for you, please let me know.

@jan-molak
Copy link
Author

Thanks @giggio, I'll try it in a moment 👍

jan-molak added a commit to serenity-js/serenity-js that referenced this issue Apr 10, 2024
jan-molak added a commit to serenity-js/serenity-js that referenced this issue Apr 10, 2024
chore(deps): upgraded chromedriver to 123.0.3 as giggio/node-chromedriver#462 is now addressed
@jan-molak
Copy link
Author

Looking good, thanks for the quick fix, @giggio!

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants