GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Selenium support user-provided network by AlexSanin · Pull Request #1207 · testcontainers/testcontainers-node

Conversation

@AlexSanin

@AlexSanin AlexSanin commented Dec 25, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

All reactions
@AlexSanin
fix(selenium): respect user-provided network when recording is enabled
cf51243
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

netlify Bot commented Dec 25, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

✅ Deploy Preview for testcontainers-node ready!

Name Link
🔨 Latest commit 4680d35
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-node/deploys/694e51ccd01ccb0008eacfa1
😎 Deploy Preview https://deploy-preview-1207--testcontainers-node.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cristianrgreco cristianrgreco added bug Something isn't working patch Backward compatible bug fix labels Dec 25, 2025
cristianrgreco
cristianrgreco reviewed Dec 25, 2025
View reviewed changes
Comment thread packages/modules/selenium/src/selenium-container.test.ts Outdated
const { exitCode } = await container.exec(["getent", "hosts", "webserver"]);
expect(exitCode).toBe(0);

await container.stop();

@cristianrgreco cristianrgreco Dec 25, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

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
All reactions
  • 👍 1 reaction
cristianrgreco
cristianrgreco approved these changes Dec 25, 2025
View reviewed changes
@cristianrgreco cristianrgreco changed the title fix(selenium): respect user-provided network when recording is enabled Selenium support user-provided network Dec 25, 2025
@AlexSanin
refactor(selenium): use await using for automatic container cleanup
4680d35
Replace manual container.stop() with await using declaration for
consistent resource management pattern across the test file.
@cristianrgreco
cristianrgreco merged commit a558850 into testcontainers:main Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cristianrgreco cristianrgreco cristianrgreco approved these changes

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Selenium container not using provided network

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@AlexSanin @cristianrgreco
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.