title: C# Selenium/ChromeDriver Add User Profile Preference
body: <p>I need to allow all cookies when running tests with selenium + chrome driver.</p>
  <p>I am trying to add this as a profile preference using <a href="https://www.selenium.dev/selenium/docs/api/dotnet/html/M_OpenQA_Selenium_Chrome_ChromeOptions_AddUserProfilePreference.htm" rel="nofollow noreferrer">ChromeOptions.AddUserProfilePreference</a></p>
  <p>I'm not 100% sure what the preference name should be to allow all cookies. I have referenced this doc <a href="https://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/pref_names.cc?view=markup" rel="nofollow noreferrer">https://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/pref_names.cc?view=markup</a></p>
  <p>and have tried the following in my setup but its not having the desired effect.</p>
  <pre><code>options.AddUserProfilePreference(&quot;profile.block_third_party_cookies&quot;, false);
  </code></pre>
  <pre><code>options.AddUserProfilePreference(&quot;security.cookie_behavior&quot;, 0);```
  </code></pre>
  <p>Here is my setup code</p>
  <pre><code>                        new DriverManager().SetUpDriver(new ChromeConfig());
                          var options = new OpenQA.Selenium.Chrome.ChromeOptions { };
                          options.AddArgument(&quot;–no-sandbox&quot;);
                          options.AddArguments(&quot;-disable-gpu&quot;);
                          options.AddArguments(&quot;-disable-dev-shm-usage&quot;);
                          options.AddArgument(&quot;-incognito&quot;);
                          options.AddArgument(&quot;-start-maximized&quot;);
                          options.AddUserProfilePreference(&quot;security.cookie_behavior&quot;, 0);
                          CurrentWebDriver = new ChromeDriver(options);
  </code></pre>