GeezerVison is showing github.com — Selenium support user-provided network by AlexSanin · Pull Request #1207 · testcontainers/testcontainers-node
Conversation
AlexSanin
commented
Dec 25, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Fixes #844
Previously, SeleniumRecordingContainer always created a new internal network, ignoring any network provided via withNetwork() or withNetworkMode(). This broke scenarios where Selenium needed to communicate with other containers on a shared network.
Changes
- Added
createNetworkIfNeeded() helper that only creates a network if the user didn't provide one
- Updated ffmpeg container to use
withNetworkMode() instead of withNetwork() for flexibility
- Made
internalNetwork optional in StartedSeleniumRecordingContainer - only cleaned up if we created it
- Added test to verify user-provided network is respected
Test plan
- Existing tests pass (backwards compatibility)
- New test verifies Selenium container can reach other containers on a user-provided network
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Previously, SeleniumRecordingContainer always created a new internal
network, ignoring any network provided via withNetwork() or
withNetworkMode(). This broke scenarios where Selenium needed to
communicate with other containers on a shared network.
The fix:
- Only create an internal network if user didn't provide one
- Use the user-provided network for both Selenium and ffmpeg containers
- Only stop the network on cleanup if we created it internally
Fixes testcontainers#844
netlify
Bot
commented
Dec 25, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
const { exitCode } = await container.exec(["getent", "hosts", "webserver"]);
|
|
|
expect(exitCode).toBe(0);
|
|
|
|
|
|
await container.stop();
|
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.
Nit: can use await using container and drop this stop
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
AlexSanin reacted with thumbs up emoji
cristianrgreco
changed the title
fix(selenium): respect user-provided network when recording is enabled
Selenium support user-provided network
Dec 25, 2025
Replace manual container.stop() with await using declaration for
consistent resource management pattern across the test file.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
bug
Something isn't working
patch
Backward compatible bug fix
Milestone
No milestone
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.