-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Add validation for invalid ChromeDriver executable path #15748
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
base: trunk
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍(Review updated until commit 4e99947)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 4e99947 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit c2f4983
Suggestions up to commit c2f4983
|
@cgoldberg you can now review my pr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a ValueError raise if the executable path is missing:
if not path:
? raise ValueError("Executable path must not be None or empty.")
That code doesn't exist in your changes. You check if it is a valid file and is executable then raise WebDriverException
.
-
The test belongs in
/selenium/webdriver/chrome/chrome_service_tests.py
since it is testingselenium.webdriver.chrome.service
. Please move it there and remove the test file you added. -
Your test imports
WebDriverException
but never uses it. Where isValueError
error coming from? -
Please re-add the docstrings and comments. Why did you remove them?
Checking for the valid/executable file seems reasonable, but I am very confused about how this change relates to your test, the linked issue, and the title of your PR.
@cgoldberg can you review the changes |
User description
Reference: #15629
This PR adds a check before invoking subprocess.Popen in the Service._start_process() method to ensure the executable path is valid.
Issue
Previously, if the path was None, subprocess.Popen() would throw a TypeError or FileNotFoundError, making it hard to trace the actual cause.
Added a ValueError raise if the executable path is missing:
if not path:
raise ValueError("Executable path must not be None or empty.")
PR Type
Bug fix, Tests
Description
Add validation for ChromeDriver executable path existence and permissions
Raise WebDriverException for invalid or non-executable paths
Add test to verify exception on invalid executable path
Minor test improvements and docstrings for clarity
Changes walkthrough 📝
service.py
Add executable path validation and improve error handling
py/selenium/webdriver/common/service.py
_start_process
chrome_service_tests.py
Add and improve tests for invalid executable path handling
py/test/selenium/webdriver/chrome/chrome_service_tests.py