-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[java] Fix 15634/ensure driver closed java #16038
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
[java] Fix 15634/ensure driver closed java #16038
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
…iceTest and SafariDriverServiceTest
The changes look good to me. Will wait for CI to pass before merging it. |
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.
Thank you! @iampopovich
User description
🔗 Related Issues
partially fixes #15634 for java
💥 What does this PR do?
similar changes as for python in #15636
🔧 Implementation Notes
This pull request enhances the robustness of driver service management in Selenium by ensuring services are properly stopped when session creation fails. It also introduces unit tests across multiple browser drivers to validate this behavior. The most important changes include updates to
RemoteWebDriver
for cleanup logic and new tests for driver service cleanup across Chrome, Edge, Firefox, and Safari.Driver Service Cleanup Enhancements:
java/src/org/openqa/selenium/remote/RemoteWebDriver.java
: Added logic to stop the driver service if session creation fails, preventing zombie processes. This includes atry-catch
block in thestartSession
method and the use ofDriverCommandExecutor
for cleanup. [1] [2]Unit Tests for Driver Service Cleanup:
java/test/org/openqa/selenium/chrome/ChromeDriverServiceCleanupTest.java
: Added a test to verify that the Chrome driver service stops when session creation fails due to invalid options.java/test/org/openqa/selenium/edge/EdgeDriverServiceTest.java
: Added a test to ensure the Edge driver service stops when session creation fails due to invalid options.java/test/org/openqa/selenium/firefox/GeckoDriverServiceTest.java
: Added a test to confirm that the Firefox driver service stops when session creation fails due to an invalid binary path.java/test/org/openqa/selenium/safari/SafariDriverServiceTest.java
: Added a test to verify that the Safari driver service stops when session creation fails due to invalid capabilities.💡 Additional Considerations
🔄 Types of changes
PR Type
Bug fix, Tests
Description
Fix driver service cleanup when session creation fails
Add unit tests for service cleanup across Chrome, Edge, Firefox, Safari
Prevent zombie processes by stopping services on session failure
Enhance error handling in RemoteWebDriver session initialization
Changes diagram
Changes walkthrough 📝
RemoteWebDriver.java
Add session failure cleanup logic
java/src/org/openqa/selenium/remote/RemoteWebDriver.java
ChromeDriverServiceCleanupTest.java
Add Chrome service cleanup test
java/test/org/openqa/selenium/chrome/ChromeDriverServiceCleanupTest.java
EdgeDriverServiceTest.java
Add Edge service cleanup test
java/test/org/openqa/selenium/edge/EdgeDriverServiceTest.java
GeckoDriverServiceTest.java
Add Firefox service cleanup test
java/test/org/openqa/selenium/firefox/GeckoDriverServiceTest.java
SafariDriverServiceTest.java
Add Safari service cleanup test
java/test/org/openqa/selenium/safari/SafariDriverServiceTest.java