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

[🚀 Feature]: [seleniumManager.js]:the Functions of the binaryPaths Method #14992

Closed
dl2458697735 opened this issue Dec 31, 2024 · 2 comments
Closed

Comments

@dl2458697735
Copy link

dl2458697735 commented Dec 31, 2024

Feature and motivation

There are two questions in total

1.The return speed of selenium manager. exe is uncertain

const smBinary = getBinary()
const spawnResult = spawnSync(smBinary, args)

The function will execute the above statement internally, and it calls an exe synchronously. The speed of the returned result is very unpredictable, sometimes very fast and sometimes very slow. At the same time, because it is synchronous, it can cause process blockage. Especially when I apply it to the electron, it will cause the electron to not respond.

I have manually specified the path for the browser and browser driver now. Can you provide a way. If there is a manual path specification, then skip the exe to obtain the path

My current solution is to modify the source code, which is a helpless decision. I directly asked him to return empty (because I had manually specified the path), which can avoid the problem of slow return results after calling exe

function binaryPaths(args) {
return {
driverPath: "",
browserPath: "",
}
}

2.Problem of obtaining exe path after packaging
There is another issue, I am using Electron to integrate Selenium, but there is a problem obtaining the path to exe after packaging is completed
The code used is
let selenium Manager BasePath=path. join (__dirname, '..', '/bin')
There is an issue with the path obtained by '__dirname' in the packaging environment
Its correct path is D:\DL\***\***\dsy-client\resources\app.asar.unpacked\node_modules\selenium-webdriver\bin\windows\selenium-manager.exe
But the path to obtaining resources through electron after packaging is
D:\DL\***\***\dsy-client\resources\app.asar\node_modules\selenium-webdriver\bin\windows\selenium-manager.exe
App.asar is a way (path) for Electron to obtain resources, but it is not applicable to exe
My temporary solution to the packaging path issue is

let seleniumManagerBasePath = path.join(__dirname, '..', '/bin')
seleniumManagerBasePath = seleniumManagerBasePath.replace("app.asar", "app.asar.unpacked")

Usage example

Provide a way to skip exe if the path is manually specified

Copy link

@dl2458697735, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@diemol
Copy link
Member

diemol commented Jan 2, 2025

If you need to skip Selenium Manager, use the same pattern mentioned here, which means you should set the driver location.

@diemol diemol closed this as not planned Won't fix, can't repro, duplicate, stale Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants