-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Description
Meta -
OS: Linux
Selenium Version: any
Browser: chrome, probably firefox as well
Browser Version: Any
How currently works
Once we create a webdriver.Remote selenium server tries to find an acceptable port to start the "new driver"(I'm not that familiar with the terms).
Digging into the code I noticed that we explicitly avoid ephemeral ports, probably to avoid race conditions with other systems binding on port 0.
This is the code path that does this:
| private static int createAcceptablePort() { |
Other systems that have full control of the host might have fixed ports for isolation, but selenium races with them.
The same thing happens with chromedriver, they have a similar approach but at least they have a fixed range that we can avoid:
https://cs.chromium.org/chromium/src/chrome/test/chromedriver/server/http_handler.cc?l=88
I think it is great the selenium actually finds a random non-ephemeral port, but this might have side effects on other distributed systems.
My proposal is to add a new capability to Remote:
| public interface CapabilityType { |
It could be a port capability that would allow others to actually specify selenium which port it should run the new driver, another solution I'd like is to actually provide selenium server a range which we consider acceptable, the latter wouldn't require adding a new capability and we could control when starting the server.