Selenium (C#) Socket exception only on Citrix

0

I'm building a Selenium automation tool for internal use at the company I work for and it has been working great so far, except for a recent demand that required my tool to run on Citrix: the WebDriver won't start. It works on any computer in the company, only not on Citrix.

I've already tried using different WebDrivers (Chrome, Firefox and IE) and different versions of the same WebDriver.

                    ChromeOptions options = new ChromeOptions();
                    options.AddArgument("--no-sandbox");
                    options.AddUserProfilePreference("", "");

                    options.SetLoggingPreference(LogType.Browser, LogLevel.All);

                    IWebDriver driver = new ChromeDriver(options);

The exception occurs on the "IWebDriver driver = new ChromeDriver(options)" line (I already tried instantiating it without the options argument).

Here's the exception that is thrown:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Net.Sockets.SocketException (0x80004005): An invalid argument was supplied
   at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
   at OpenQA.Selenium.Internal.PortUtilities.FindFreePort()
   at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService()
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
   at RobôGenérico.Automatização.InitializeSelenium() in C:\Projetos\RobôGenérico\RobôGenérico\RobôGenérico\Homologação\SeleniumWrapper.cs:line 461
   at RobôGenérico.Automatização.FollowScript(Int32 iterations, List`1 script) in C:\Projetos\RobôGenérico\RobôGenérico\RobôGenérico\Homologação\SeleniumWrapper.cs:line 953
   at RobôGenérico.Automatização.RunTest() in C:\Projetos\RobôGenérico\RobôGenérico\RobôGenérico\Homologação\Automatizacao.cs:line 96
   at RobôGenérico.Automatização.StartAutomation_Click_1(Object sender, EventArgs e) in C:\Projetos\RobôGenérico\RobôGenérico\RobôGenérico\Homologação\Automatizacao.cs:line 25
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.3062.0 built by: NET472REL1
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
eStaff
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file://corfs02/home/Users/ANDRCEC/Desktop/eStaff/eStaff.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.3062.0 built by: NET472REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.3062.0 built by: NET472REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.3062.0 built by: NET472REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.3062.0 built by: NET472REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.3081.0 built by: NET472REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.3062.0 built by: NET472REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
WebDriver
    Assembly Version: 3.141.0.0
    Win32 Version: 3.141.0.0
    CodeBase: file://corfs02/home/Users/ANDRCEC/Desktop/eStaff/WebDriver.DLL
----------------------------------------
System.Windows.Forms.DataVisualization
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.3062.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.DataVisualization/v4.0_4.0.0.0__31bf3856ad364e35/System.Windows.Forms.DataVisualization.dll
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.3081.0 built by: NET472REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
CsvHelper
    Assembly Version: 12.0.0.0
    Win32 Version: 12.0.0.0
    CodeBase: file://corfs02/home/Users/ANDRCEC/Desktop/eStaff/CsvHelper.DLL
----------------------------------------
Spire.XLS
    Assembly Version: 9.2.12.61040
    Win32 Version: 9.2.12.61040
    CodeBase: file://corfs02/home/Users/ANDRCEC/Desktop/eStaff/Spire.XLS.DLL
----------------------------------------
Spire.Pdf
    Assembly Version: 5.2.8.19040
    Win32 Version: 5.2.8.19040
    CodeBase: file://corfs02/home/Users/ANDRCEC/Desktop/eStaff/Spire.Pdf.DLL
----------------------------------------
Spire.License
    Assembly Version: 1.3.7.40
    Win32 Version: 1.3.7.40
    CodeBase: file://corfs02/home/Users/ANDRCEC/Desktop/eStaff/Spire.License.DLL
----------------------------------------
System.ValueTuple
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.3062.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.ValueTuple/v4.0_4.0.0.0__cc7b13ffcd2ddd51/System.ValueTuple.dll
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
    Assembly Version: 0.0.0.0
    Win32 Version: 4.7.3062.0 built by: NET472REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
Open3270
    Assembly Version: 1.5.0.1
    Win32 Version: 1.5.0.1
    CodeBase: file://corfs02/home/Users/ANDRCEC/Desktop/eStaff/Open3270.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
c#
selenium
asked on Stack Overflow Sep 25, 2019 by cecchi • edited Sep 25, 2019 by cecchi

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0