Modified these files to ensure that proper error is displayed while r… #4271
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FIXES #3105
Running selenium server locally without installing java first in the system
###Usage Examples
Changes Made
1. Import Required Modules
The following modules were imported to enhance the functionality of the service builder:
which
: Used to locate the Java executable in the system's PATH.fs.promises
: Provides asynchronous file system operations.Logger
: Assumed to be exported from a utility module for logging purposes.2. Modified
SeleniumServer4
ConstructorjavaPath
as the first parameter, decoupling Java detection from the constructor logic.javaPath
: The detected Java executable path is passed to the parentDriverService
class.3. Added
findJavaExecutable
MethodJAVA_HOME
environment variable and then falling back to searching the system's PATH.4. Added
checkExecutable
MethodfindJavaExecutable
to ensure the Java binary is usable.5. Modified
createService
MethodfindJavaExecutable
to retrieve the Java executable path before proceeding.javaPath
is passed to theSeleniumServer4
constructor.6. Caching Java Path
_javaPath
to cache the detected Java path, avoiding redundant checks in subsequent service starts.###################################################
Thanks in advance for your contribution. Please follow the below steps in submitting a pull request, as it will help us with reviewing it quicker.
examples/tests
directory of the project) and running them.ecosia.js
andduckDuckGo.js
are good examples to work with.features/my-new-feature
orissue/123-my-bugfix
);