title: Selenium C# Error: System.InvalidOperationException : Could not start a new session
body: <p>I have some tests that I execute against a standalone-chrome docker container through bitbucket pipelines. The tests were working fine for the last few months until this week wherein I see the below error occuring randomly for some tests:</p>
  <pre><code>System.InvalidOperationException : Could not start a new session. New session request timed out
  Build info: version: '4.3.0', revision: 'a4995e2c09*'
  System info: host: '288d627651eb', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.13.0-1031-aws', java.version: '11.0.15'
  Driver info: driver.version: unknown (SessionNotCreated)
     at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse)
     at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
     at OpenQA.Selenium.WebDriver.StartSession(ICapabilities desiredCapabilities)
     at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
     at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
     at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities, TimeSpan commandTimeout)
     at AutoTests.Resources.WebdriverFactory.Create() in /opt/atlassian/pipelines/agent/build/AutoTests/Resources/WebdriverFactory.cs:line 78
     at AutoTests.Pages.Outlook.OutlookPage.OpenOutlook() in /opt/atlassian/pipelines/agent/build/AutoTests/Pages/Outlook/OutlookPage.cs:line 64
     at AutoTests.Pages.Outlook.OutlookPage.LoginToOutlook(String emailId, String password) in /opt/atlassian/pipelines/agent/build/AutoTests/Pages/Outlook/OutlookPage.cs:line 30
     at AutoTests.Tests.DualVerificationTests.TC_03_Validate_Self_Registration__Approved() in /opt/atlassian/pipelines/agent/build/AutoTests/Tests/DualVerificationTests.cs:line 292
  </code></pre>
  <p>I read that it can be an issue with shm which may cause a page crash, so in the docker run command I have also set the chrome option to disable &quot;--disable-dev-shm-usage&quot; but still facing the issue.
  Below are the chrome options I am using</p>
  <pre><code>var chromeDockerOptions = new ChromeOptions();
  chromeDockerOptions.AddUserProfilePreference(&quot;download.default_directory&quot;, GenericHelpers.GetAssemblyLocation());
  chromeDockerOptions.AddArgument(&quot;--no-sandbox&quot;);
  chromeDockerOptions.AddArgument(&quot;--disable-dev-shm-usage&quot;);
  chromeDockerOptions.AddUserProfilePreference(&quot;profile.default_content_setting_values.automatic_downloads&quot;, 1);
  
  return new RemoteWebDriver(new Uri(&quot;http://localhost:4444/wd/hub&quot;), chromeDockerOptions.ToCapabilities(), TimeSpan.FromMinutes(timeout));
  </code></pre>
  <p>Would appreciate if someone can help me in resolving this issue. Thanks.</p>