-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Description
Description
We are using the ChromeDriverService.CreateDefaultService method, with the 4.35 release the change to the FindFreePort method to work for IPv6. Our teamcity agent only has an IPv4 address assigned. We would expect to work for both IPv6 and fall back to IPv4 if it cannot find an Active IPv6 address. We get a SocketException at the point of binding the address.
Note: This code works locally as I have both IPv4 and IPv6 addresses available to use. This will only be replicated on IPv4 only environment.
I added code to scan the teamcity agent NetworkInterface to see if there were any IPv6 Addresses available.
2025-08-20 | INFO | Framework.Browser | No IPv6 addresses found on this machine.
2025-08-20 | ERROR | Framework.Browser | Failed to create ChromeDriverService: Cannot assign requested address
Stack Trace:
System.Net.Sockets.SocketException : Cannot assign requested address
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at OpenQA.Selenium.Internal.PortUtilities.FindFreePort()
at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService()
at Framework.Browser.SetUpBrowser(String url) in /teamcity-agent/work/f82368d80a877b9c/Browser.cs:line 321
Reproducible Code
using var socket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
socket.DualMode = true;
socket.Bind(new IPEndPoint(IPAddress.IPv6Loopback, 0));
return (socket.LocalEndPoint as IPEndPoint)!.Port;
ℹ️ Last known working version: 4.34