Skip to content

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

@dl2458697735

Description

@dl2458697735

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-enhancementSomething could be better

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions